Shortcode to return an image based on post taxonomy

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

WordPress upgrade adding additional quote marks to shortcode output

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

Why aren’t paragraphs breaking on this page?

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

How can I add 2 buttons with shortcode

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