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 have the following code for a page. When I select the template Home Page from the drop down menu in the page edit, it doesn't work on my web host, but locally it works fine, so I don't think it is my code. I don't know why its not working though.

Template Name:Home Page
<?php get_header(); ?>
<div class="row">
    <div id="welcome" class="seven columns centered">
        $page_id = 2; 
        $page_data = get_page( $page_id );
        $content = apply_filters('the_content', $page_data->post_content);
        echo $content;

<?php get_footer(); ?>
share|improve this question
up vote 1 down vote accepted

Might be a difference in query methods. This is a simpler way to query a page's content and can be used multiple times in a template without each query conflicting with each other.

<?php $my_query = new WP_Query('page_id=2'); ?>

<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>

<?php the_content(); ?>

<?php endwhile; ?>
share|improve this answer
This seemed to work. It also fixed it self when I renamed the home.php file to something else, not sure why that would be. – Anders Kitson Mar 14 '12 at 3:51

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.