Enable shortcodes in a wordpress theme

I develop a new theme for wordpress 3.3.1 from scratch and shortcodes are not working on it.
As I searched until now it is a matter of filtering the content containing the shortcode, filter code added in a theme specific location(shorcodes are working with another theme).
So, my question is : What is the code for a general shortcode theme enable ?

Related posts

Leave a Reply

2 comments

  1. 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.

  2. 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);