• I have a static home page, which works fine. I set my blog posts page to “News” — it shows the posts, but it shows them twice. Once using my page template, and again using my post template.

    So far I just have

    index.php
    page.php

    I have not created any category or single templates.

    You can see the page here:

    My wordpress loop on index.php looks like:

    <?php if (have_posts()) : ?>
    
    		<?php while (have_posts()) : the_post(); ?>
    
    			<div <?php post_class() ?> id="post-<?php the_ID(); ?>"><div class="padding"><!--post-->
                	<div class="date"><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></div>
    				<div class="title"><h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2></div><br class="clear" />
    
    				<div class="entry">
    					<?php the_content('Read the rest of this entry &raquo;'); ?>
    				</div>
    
    				<div class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></div>
    			</div></div><!--post-->
    
    		<?php endwhile; ?>
    
    		<div class="navigation">
    			<div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
    			<div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
    		</div>
    
    	<?php else : ?>
    
    		<h2 class="center">Not Found</h2>
    		<p class="center">Sorry, but you are looking for something that isn't here.</p>
    		<?php get_search_form(); ?>
    
    	<?php endif; ?>

    My loop on page.php looks like:

    <?php if (have_posts()) : ?>
    
    		<?php while (have_posts()) : the_post(); ?>
    
    			<div <?php post_class() ?> id="post-<?php the_ID(); ?>"><div class="padding"><!--post-->
    				<div class="title"><h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2></div><br class="clear" />
    
    				<div class="entry">
    					<?php the_content('Read the rest of this entry &raquo;'); ?>
    				</div>
    
    			</div></div><!--post-->
    
    		<?php endwhile; ?>
    
    		<div class="navigation">
    			<div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
    			<div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
    		</div>
    
    	<?php else : ?>
    
    		<h2 class="center">Not Found</h2>
    		<p class="center">Sorry, but you are looking for something that isn't here.</p>
    		<?php get_search_form(); ?>
    
    	<?php endif; ?>

    I am usually able to find what I’m looking for in the docs and on the forums, but I can’t seem to figure out what is causing this? I would expect that it should just show the posts, and maybe the title and description written on the news page if anything. Is there something I should be adding to my templates? Should I create a new template for news (news.php)? Note that I tried doing that as well but it didn’t seem to have any affect.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Not quite sure what the problem is. Can you post a link to the site?

    Thread Starter ingero

    (@ingero)

    Sure, here it is:

    Static Homepage
    News Page

    Like your site! Did you set a template for the News Page? If so, try using just the default.

    Thread Starter ingero

    (@ingero)

    Thanks!

    I did try setting up a template for the news page, but it had the same results. The news template was pretty much identical to my index.php template. Should I be doing something differently? I will try making it again and report my findings.

    Thread Starter ingero

    (@ingero)

    As I thought, same issue with the News template (and yes, I remembered to edit my News page and change the template to News).

    Here’s what my template looks like for news.php

    <?php
    /**
     * @package WordPress
     * @subpackage goatramp
     * Template Name: News
     */
    
    get_header(); ?>
    
        <div id="content-container"><!--content-container-->
    
            <div class="billboard"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/fpo-billboard.jpg" /></div>
    
    		<div class="content"><!--content-->
    
    <?php if (have_posts()) : ?>
    
    		<?php while (have_posts()) : the_post(); ?>
    
    			<div <?php post_class() ?> id="post-<?php the_ID(); ?>"><div class="padding"><!--post-->
                	<div class="date"><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></div>
    				<div class="title"><h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2></div><br class="clear" />
    
    				<div class="entry">
    					<?php the_content('Read the rest of this entry &raquo;'); ?>
    				</div>
    
    				<div class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></div>
    			</div></div><!--post-->
    
    		<?php endwhile; ?>
    
    		<div class="navigation">
    			<div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
    			<div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
    		</div>
    
    	<?php else : ?>
    
    		<h2 class="center">Not Found</h2>
    		<p class="center">Sorry, but you are looking for something that isn't here.</p>
    		<?php get_search_form(); ?>
    
    	<?php endif; ?>
    
            </div><!--content-->
    
    <?php get_sidebar(); ?>
    
    </div><!--content-container-->
    
    <?php get_footer(); ?>

    Thread Starter ingero

    (@ingero)

    Oh, here are my settings & news page screen caps from the admin area:

    Screen Caps

    I don’t see anything in the code to explain it. Try deactivating all plugins to see if that changes anything. If that does not work, try switching to the default theme.

    Also, what happens if you use the ‘Front page displays Your latest Posts’ option instead of a Static page?

    Thread Starter ingero

    (@ingero)

    It appears to do the same thing when I set it to show my latest posts vs static page — good thinking.

    Plugins… I only have one plugin installed for sifr, and deactivating that made no difference.

    I switched to a default theme and that seems to fix it. I guess I will look at my index.php template more closely, although I originally just copy and pasted from the default template :\

    Thank you for your help so far!

    Thread Starter ingero

    (@ingero)

    Ok, I think I figured this out.

    home.php (my home template) seems to have been the problem. It worked for home, but when I tried to load the news page it was also using that template, and then displaying my posts double. Not really sure why, but if I renamed home.php in my theme folder to homepage.php… presto. Now it works.

    I seem to remember a long time ago that you couldn’t make a home.php in your theme directory but when I was recently looking up information regarding templates and such, I didn’t recall seeing it, so I thought perhaps that was no longer an issue. Oops.

    Thanks for your help vtxyzzy. I truly appreciate it!

    WOW – glad you figured it out! Now, please use the dropdown at top right to mark this topic ‘Resolved’.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Page of Blog Posts – showing them twice ??? static front page’ is closed to new replies.