How to Get Shortcode in Excerpt to follow Document Flow
Shortcode’s callback should return a string, not echo it. function getMyShortCode_func() { return ‘<div class=”abc”>Hello world.</div>’; }
Shortcode’s callback should return a string, not echo it. function getMyShortCode_func() { return ‘<div class=”abc”>Hello world.</div>’; }
There’s no need to replicate The Loop in your plugin; WordPress is working within a post when it processes a shortcode, so the post ID is available when the shortcode is being processed. Also, your arguments for has_term are out of order. And finally, it’s a best practice to make a shortcode all one word. … Read more
This is probably the result of the wordpress 4.0.1 security fix which changed how shortcodes are handled http://wptavern.com/wordpress-4-0-1-exposes-bad-development-practices-used-in-some-plugins. While I am not sure about the details your shortcode handling seems to match the general description of trying to parse the shortcode by yourself instead of properly registering it. To fix this you need to create, … Read more
Your output is expected, but before I come to the solution and why’s, you have a couple of issues here You are either using query_posts or nullifying the main query global which you should never do. The give away is your loop (if (have_posts()) : while (have_posts()) : the_post();) and the use of wp_reset_query();. You … Read more
It seems that you might have a lot of these .csv files. I would suggest to use only one attribute and then passing the appropriate name to that attribute or the prefix of the file name and then building the file name from there. You can try one of the following (I have not done … Read more
The do_shortcode function runs on the the_content hook: 402 403 add_filter(‘the_content’, ‘do_shortcode’, 11); // AFTER wpautop() https://core.trac.wordpress.org/browser/tags/4.1.1/src/wp-includes/shortcodes.php#L403 So, without seeing your theme code I am going to guess that your theme’s archive page is written in such a way that the do_shortcode function does not fire– possibly because it uses the_excerpt instead of the_content. If … Read more
get_the_content() returns unfiltered content, and using a shortcode you cannot use the_content() to return filtered content as you cannot echo inside a shortcode. Your best option here will be is to applying the_content filters to get_the_content(), something like: apply_filters( ‘the_content’, get_the_content() ); EDIT Exact usage, replace $output .= get_the_content(); with $output .= apply_filters( ‘the_content’, get_the_content() … Read more
If I enter this shortcode: [download url=”http://example.com”]Download[/download] it works fine. But you have to enter the link text as content yourself. You might have missed that, the way I read your question. Your [demo]-Shortcode throughs an error. To see this, you need to have WP_DEBUG set to true: Notice: Undefined variable: func in \wp-includes\shortcodes.php on … Read more
I’m not quite sure what you want to do as frankly, your terminology is a bit scrambled, and you example shortcode is also quite a mess. Before I start, you should start of by checking the following very important links Shortcode API WP_Query You should first start of by defining your attributes (and their defaults) … Read more
Instead of calling the iframe , You can register a widget that will contain all the HTML code.Another way can be outputting the whole HTML code instead of iframe.”id” can be controlled in the same manner. Combine all CSS files and JS files and then enqueue them in the same manner.Keep HTML code only between … Read more