WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i am trying to insert a post/page into one of my themes files and it wont display shortcodes or php

i have created a page called home in the wordpress admin-paned and inserted into my code the following:

<div id="home_page"> <!-- echos the content from the page "home" id:43 -->
            <?php $home_id = 43;
            $home_page = get_page( $home_id );
            <?php echo $home_page->post_content; ?>
    </div> <!-- end #home_page -->

and non of the shortcodes that i have in the page work. i installed a php in post or page and tried useing php and it doesnt work.

when i insert

echo do_shortcode('[youtube_sc url=http://www.youtube.com/watch?v=Db3XGpt6nNU]');

directly into the code it works.

does anyone know y this happens?

thank you.

share|improve this question
up vote 1 down vote accepted

You need to apply the filter the_content e.g.:

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

Also, you don't need custom shortcodes for youtube, just put the URL in the content (but not a hyperlink), and it'll be swapped out for a youtube player at runtime. No plugins or extra code needed thanks to oembed.

share|improve this answer
Thank you so much. I have been going crazy!! – Dvir Levy Apr 4 '12 at 15:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.