Reputation: 1408
When I use shortcode on page works good but on posts is displayed only shortcode name. Example shortcode:
function foobar_func( $atts ){
return "foo and bar";
}
add_shortcode( 'foobar', 'foobar_func' );
Usage:
[foobar]
On page is displayed
foo and bar
but on post only
[foobar]
I tryied on basic theme like TwentySeventenn and the problem still exists.
Upvotes: 0
Views: 671
Reputation: 1895
It's very strange. So you added the above code to TwentySeventenn theme's functions.php, but it does not work on post? Please double check you write [foobar] correctly on your post content file. Or if you changed something on the theme, please check you used the_content() instead of echo get_the_content(); shortcodes are not working if you use get_the_content();
Upvotes: 1