• Resolved John

    (@jhob)


    I have a static home page with my posts on a page with slug ‘blog’. When I create this page as a page I can see it fine in the browser but when I set it as the posts page it displays the homepage. I am using a modified version of the kubrick theme.

    I can’t figure out why this is happening, could anyone provide suggestions for how I might go about trouble shooting and resolving this issue?

    Thanks in advance for any replies.

Viewing 7 replies - 1 through 7 (of 7 total)
  • When you say “modified” did you modify it?

    I had a similar issue early on before realizing it was a template problem. I changed my index.php page into a home page, which then made wordpress go looking for it when throwing up posts… or when not finding what it was looking for.

    http://codex.wordpress.org/images/1/18/Template_Hierarchy.png

    http://codex.wordpress.org/Template_Hierarchy

    Thread Starter John

    (@jhob)

    Yes, I did modify it, mostly just css with a little bit of work in the templates to postition left/right menus where I wanted them. I have a separate template for the the home page, all other pages use the default template.

    I have set it up exactly as described in the post from MichaelH.

    Here’s index.php:

    <?php get_header(); ?>
    
    	<div id="content" class="narrowcolumn">
    
    	<?php if (have_posts()) : ?>
    
    		<?php 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>
    				<small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
    
    				<div class="entry">
    					<?php the_content('Read the rest of this entry &raquo;'); ?>
    				</div>
    
    				<p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
    			</div>
    
    		<?php endwhile; ?>
    
    		<div class="navigation">
    			<div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div>
    			<div class="alignright"><?php previous_posts_link('Next 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 /* include (TEMPLATEPATH . "/searchform.php"); */ ?>
    
    	<?php endif; ?>
    
    	</div>
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    single.php:

    <?php get_header(); ?>
    
    	<div id="content" class="widecolumn">
    
    	<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    		<div class="navigation">
    			<div class="alignleft"><?php previous_post_link('&laquo; %link') ?></div>
    			<div class="alignright"><?php next_post_link('%link &raquo;') ?></div>
    		</div>
    
    		<div class="post" id="post-<?php the_ID(); ?>">
    			<h2><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    
    			<div class="entry">
    				<?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>
    
    				<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    
    				<p class="postmetadata alt">
    					<small>
    						This entry was posted
    						<?php /* This is commented, because it requires a little adjusting sometimes.
    							You'll need to download this plugin, and follow the instructions:
    							http://binarybonsai.com/archives/2004/08/17/time-since-plugin/ */
    							/* $entry_datetime = abs(strtotime($post->post_date) - (60*120)); echo time_since($entry_datetime); echo ' ago'; */ ?>
    						on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>
    						and is filed under <?php the_category(', ') ?>.
    						You can follow any responses to this entry through the <?php comments_rss_link('RSS 2.0'); ?> feed.
    
    						<?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
    							// Both Comments and Pings are open ?>
    							You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(true); ?>" rel="trackback">trackback</a> from your own site.
    
    						<?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
    							// Only Pings are Open ?>
    							Responses are currently closed, but you can <a href="<?php trackback_url(true); ?> " rel="trackback">trackback</a> from your own site.
    
    						<?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
    							// Comments are open, Pings are not ?>
    							You can skip to the end and leave a response. Pinging is currently not allowed.
    
    						<?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
    							// Neither Comments, nor Pings are open ?>
    							Both comments and pings are currently closed.
    
    						<?php } edit_post_link('Edit this entry.','',''); ?>
    
    					</small>
    				</p>
    
    			</div>
    		</div>
    
    	<?php comments_template(); ?>
    
    	<?php endwhile; else: ?>
    
    		<p>Sorry, no posts matched your criteria.</p>
    
    <?php endif; ?>
    
    	</div>
    
    <?php get_footer(); ?>

    Thanks everyone for your help so far.

    Thread Starter John

    (@jhob)

    I just upgraded to 2.8.1 but this hasn’t resolved the problem.

    Change to the WordPress Default theme. If the problem goes away then you know it is your theme, if it doesn’t go away could be a plugin.

    Thread Starter John

    (@jhob)

    I just did that and it worked so definitely a templating issue, I will keep staring at it and see if anything obvious occurs to me. If anyone else spots something in the code above then please let me know!

    cheers all for the help.

    Thread Starter John

    (@jhob)

    Managed to sort this problem out. The issue was that the template for the homepage was called home.php and I think the posts page returns true for is_home() and so the home.php template is called.

    To fix the problem I changed the filename to homepage.php. Reading the template hierarchy document helped me make sense of it all.

    cheers all!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Posts page is showing home page’ is closed to new replies.