Image Caption Shortcode Broken upon update
Image Caption Shortcode Broken upon update
Image Caption Shortcode Broken upon update
Instead of calling do_shortcode() just call the function associated with the shortcode. Example There is a shortcode named [example] and a function registered as shortcode handler: function example_shortcode( $atts = array(), $content=”” ) { extract( shortcode_atts( array ( ‘before’ => ”, ‘after’ => ”, ), $atts ) ); return $before . $content . $after; } … Read more
I tried some codes, and I think finally works after several tries: function ts_day_f() { $posts= get_posts(array( ‘numberposts’ => -1, ‘post_status’ => ‘publish’, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘date_query’ => array( ‘column’ => ‘post_date’, ‘after’ => ‘today’, ‘before’ => ‘tomorrow – 1 second’, ) )); if ( is_user_logged_in()) { //return count($posts); $c = count($posts); … Read more
The main issue is that you’ve mixed up two methods of querying posts. You’re querying the correct posts here: $posts = get_posts(array( ‘numberposts’ => -1, ‘post_type’ => ‘assessment’, ‘meta_key’ => ‘customer’, ‘meta_value’ => $current_user_id )); But then the posts you’re actually looping through are queried here: $the_query = new WP_Query( $args ); Where $args is … Read more
You need to pass your attributes in the shortcode as key-value pairs, and use them in php as an array as follows: [tagtagtag tag_id=246] function get_categories_with_product_in_tag( $atts ) { global $wpdb; return $wpdb->get_results( $wpdb->prepare( “SELECT categories.* FROM “. “{$wpdb->prefix}terms categories “. “INNER JOIN {$wpdb->prefix}term_taxonomy ctax ON (categories.term_id = ctax.term_id) “. “INNER JOIN {$wpdb->prefix}term_relationships crel ON … Read more
I solved the problem in this way. Maybe someone will need it. Configured the modal window so that a cookie is created when the window is closed. Launched a modal window until the user closes the window and a cookie is created. Here is the code: … if ( ! isset( $_COOKIE[“pum-909”] ) ) { … Read more
Maybe there is a better solution, but serialize seems to do the job. Instead of json I could pass json_decoded and then serialized parameters. For example $jsonval = json_decode(‘{“foo”: “bar”}’); $serialized = serialize($jsonval); Shortcode will be something like: [myshortcode parameters=”O:8:”stdClass”:1:{s:8:”foo”;s:3:”bar”;}”] At this point I can handle parameters unserializing them: function myshortcodehandler($atts){ $arrparameters = (array) unserialize($atts[“parameters”]); … Read more
Use the below code it may help you and sure that your sql query is correct then it will be work properly. function wpb_demo_shortcode() { global $wpdb; $results = $wpdb->get_results( $wpdb->prepare(“SELECT DISTINCT o.order_id, o.`order_item_name`, om.`meta_value` as ‘bcs’, (select pm.`meta_value` from `wp_postmeta` as pm WHERE o.order_item_id = om.order_item_id AND pm.`post_id` = o.order_id AND pm.`meta_key` = ‘2-certificate’) … Read more
is it possible for a URL to filter by tag
You can absolutely pass arguments to your shortcode, but not in the method you described. Please see the Shortcode API (https://codex.wordpress.org/Shortcode_API) Your shortcode with arguments will look more like: [vertical_posts label=Answers category=answers number=4]