• I’m trying to add pagination to my frontpage.

    It’s currently set to Settings –> Reading –> Static Page –> Frontpage: home

    I’m using a custom template for the homepage.

    I have my template-home.php open and it looks like this:

    <?php
    /*
    Template Name: Home
    */
    ?>
    
    <?php get_header(); ?>
    
        <div id="middle">
    
            <div class="container content-background">
    
            	<!---------------------------------------------------------------------------------------------*/
    	        /*--------------------------------------------------------------------------------------------->
    
    	        <?php// wp_reset_query(); ?>
    
            	<?php
    			if ( get_query_var('paged') ) { $paged = get_query_var('paged'); }
    			elseif ( get_query_var('page') ) { $paged = get_query_var('page'); }
    			else { $paged = 1; }
    
    			query_posts('posts_per_page=3&paged=' . $paged);
    			?>
    			<!---------------------------------------------------------------------------------------------*/
    	        /*--------------------------------------------------------------------------------------------->
    
                <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
                   <!--BEGIN #main-content -->
                <section class="main-content top-margin eleven columns"> 
    
                      <?php /* Widgetised Area */ if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar( 'Homepage Main' ) ); ?>
                      <div style="clear:both">
    	                  <?php the_content(); ?>
                      </div>
                      <!--BEGIN .navigation-->
    
                </section>
    
                <aside class="sidebar top-margin five columns">
                <?php /* Widgetised Area */ if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar( 'Homepage Sidebar' ) ); ?>
                </aside>
    
            <?php endwhile; ?>
    
            	<!---------------------------------------------------------------------------------------------*/
    	        /*--------------------------------------------------------------------------------------------->
    			<div class="navigation">
    
    				<div class="nav-old"><?php next_posts_link(__('&larr; Older Entries', 'framework')) ?></div>
    				<div class="nav-new"><?php previous_posts_link(__('Newer Entries &rarr;', 'framework')) ?></div>
    
    			<!--END .navigation-->
    			</div>
    			<!---------------------------------------------------------------------------------------------*/
    			/*--------------------------------------------------------------------------------------------->
    
    			<?php echo paginate_links(); ?>
            <?php endif; ?>            
    
            <!--END .container-->
    		</div>
        <!--END #middle-->
        </div>
    
    </div>
    
    <?php get_footer(); ?>

    I read the “static front page” section of this page an it’s not working for me.

    When I run the template it duplicates all my posts, show 6 posts and duplicates my header section. however my Settings –> Reading –> Says 5

  • The topic ‘Pagination w/Static Front Page’ is closed to new replies.