Support » Fixing WordPress » Home page shows twice

  • Resolved eatanicecream


    One of my users has set up a blog with a static homepage, but for some strange reason the Home page is shown twice – once where it’s supposed to be but also where the posts are supposed to be – in ‘Blog’.

    Everything has been done right (as far as I can see), they’ve chosen Home as front page and Blog as posts page in the back end.

    The blog is here:

Viewing 7 replies - 1 through 7 (of 7 total)
  • I think the static front page is pulling in post 5, and that is also in the Blog. You will need to exclude that post, or the ‘home’ category, from the Blog.

    Looks like you are using a custom theme, so I can’t give more specific instructions, because I can’t see the code.

    It seems that you have added the static page with home name. For you need to either the default home from the navigation list of your blog. You can do it with these options:

    1) Hide the pages in navigation bar. On how to Hide the pages refer this article:

    2) You need to edit the header.php file of your theme and remove this code:

    <li><a href=”……>Home (Page?)</a></li>

    It will remove the default home page link from the navigation window.

    That’s it!


    Shane G.

    @vtxyzzy No, the problem is that the blog is pulling in a page instead of posts.

    @shane I changed the name of the static page to ‘Welcome’ instead of ‘Home’. No difference.

    I don’t want to exclude the pages from the menu.

    The code I’m using for the menu is ‘<?php wp_page_menu( array( ‘show_home’ => ‘Home’, ‘sort_column’ => ‘menu_order’ ) ); ?> ‘. I tried removing the “show_home” bit. No difference.

    Any other suggestions?

    It is difficult to offer suggestions without being able to see the code. Can you post a section of the Blog template (index.php?) showing the query?

    When I look in the source code for the Home page, I see this:

    <div class="page" id="post-5">

    In the Blog page, I see this:

    <div class="post" id="post-5">

    Since the id is the same, I am guessing that the Blog template is set to query pages, but it may be that the Home page is querying posts. What happens when you post another topic in the Blog?

    Thanks for helping. Here’s the loop:

    <?php query_posts(''); ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    			<div class="post" id="post-<?php the_ID(); ?>">
    				<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2><br />
                     <?php if ( !is_category('') ) { ?>
    <div class="small">
    				<p>Posted by <?php the_author_posts_link(); ?>
     on <?php the_time('j F Y') ?>
    <?php the_time() ?> | <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
    <p>Posted in: <?php the_category(', ') ?></p>
    					<div class="postbg"><?php the_content('Read more &raquo;'); ?></div>
    <div class="post-footer">
    <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('Leave a comment', 'Leave a comment', 'Leave a comment'); ?></p>
    <?php } ?>

    When I create another post it disappears into the ether. 🙂 Here’s one:

    The <div class="post" id="post-5"> issue you’re seeing is just due to my poor naming in the template, I think.

    You didn’t say if the snippet you posted came from index.php, or another file. It should be from index.php because I am pretty sure that WP ignores a template for the blog.

    The only thing I see that might be a problem is the use of query_posts(). Try taking that out of the template – index.php should not need that because the query has already been done before index.php is called.

    Brilliant, that’s done it – thank you!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Home page shows twice’ is closed to new replies.