• I’m customizing my template and want to display blog entries on a separte page.

    Basically what I have done is the following:

    1. duplicated index.php and heavily modified it – this will be my home page
    2. The copy of index.php I re-named blog.php and left as is – I added a “template name to the top of the file so that I can select it when I create a blog page (see 3)
    3. I created an empty page and called it “blog” – I selected the “blog” template I defined above.

    When navigate to “my_site/blog” I don;t get any posts…

    Home page works perfect as I modified it.

    Any ideas why this would be happening?

    Below is the code for my blog.php page…

    <?php
    /*
    Template Name: Blog-home
    */
    ?>
    <?php get_header(); ?>
    
    	<div class='grid_1'>&nbsp;</div>
    
    	<div class="grid_14">
    
    	<?php if (have_posts()) : ?>
    
    		<?php while (have_posts()) : the_post(); ?>
    
    			<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    			<span class="postmetadata"><?php the_category(' / ') ?> &mdash; <?php edit_post_link('Edit', '', ' &mdash; '); ?>  <?php comments_popup_link('No comments', '1 comment', '% comments'); ?></span><br />
    			    <small><span class="date"><?php the_time('d') ?></span><br /><?php the_time('M y') ?> <!-- by <?php the_author() ?> --></small>
    				<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    
    				<div class="entry">
    					<?php the_content('<em>Continue reading &rarr;</em>'); ?>
    				</div>
    				<div class="clearfix"></div>
    
    			</div>
    
    		<?php endwhile; ?>
    
    		<div class="navigation">
    			<div class="alignleft"><?php next_posts_link('&larr; Older Entries') ?></div>
    			<div class="alignright"><?php previous_posts_link('Newer Entries &rarr;') ?></div>
    			<div class="clearfix"></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>
    
    	<?php get_sidebar(); ?>
    
    	<div class='grid_1'>&nbsp;</div>
    
    	<div class='clear'>&nbsp;</div>
    
    	<br />
    
    	<?php get_footer(); ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘blog on separate page’ is closed to new replies.