Simple shortcode to check if a user has commented on a certain post

You made 2 small errors. First of all: Shortcode-Functions receive a maximum of 2 parameters: $attributes and $content. $attributes is an array of all the attributes within the shortcode, like [shortcode post_id=123] the attribute post_id will end up in the $attributes array as $attributes[‘post_id’]. $content has the content between the opening and the closing shortcode … Read more

How to pass text input data to shortcode

You would need to do this in the shortcode function for [api_request]. Here’s a potential answer with a ternary that would check if the $_POST value exists, if so, sanitize and use it, otherwise use the value passed in the shortcode: $q = ( isset( $_POST[‘q’] ) ) ? sanitize_text_field( $_POST[‘q’] ) ? $atts[‘q’]; This … Read more

Subtract Using GravityWP Count Plugin

Use $add_number if $sub_number is 0, else use $sub_number: $sorting = null; $paging = array( ‘offset’ => 0, ‘page_size’ => $page_size ); $entries = GFAPI::get_entries($formid, $search_criteria, $sorting, $paging); $countentries = GFAPI::count_entries( $formid, $search_criteria ); if(!$sub_number) { $countentries_add = $add_number + $countentries; if ( !empty( $number_field ) ) { $gwp_count = $add_number; for ($row = 0; … Read more

Executing a shortcode at the top of PAGE template?

The do_shortcode function accepts a string, searches the string for shortcodes, and processes any that are found. That means that… // Use shortcode in a PHP file (outside the post editor). echo do_shortcode(”); … is all you need to run a shortcode (code taken from the Codex). Your request that the shortcode be inserted “somewhere … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)