Enable shortcodes in a wordpress theme Enable shortcodes in a wordpress theme wordpress wordpress

Enable shortcodes in a wordpress theme


To execute a single shortcode, run it with

echo do_shortcode('[your_short_code]');

If the shortcode(s) are in the post content, make sure you're displaying it with

<?php the_content();?>

Or

<?php echo apply_filters('the_content',$post_content);?>

Or

<?php echo apply_filters('the_content',$wp_query->post->post_content);?>

The important thing is: if you aren't using the function "the_content()" you need this line <?php echo apply_filters('the_content',$wp_query->post->post_content);?> where in the second argument you have to put the variable of the post content you want to show.


I had to save the theme's content to a variable and then use the second example.. Worked like a charm.

$mycontent = ot_get_option('rightcontent');                     echo apply_filters('the_content',$mycontent);