WordPress.org

Ready to get started?Download WordPress

Forums

Pagination outside the loop from front-page template (4 posts)

  1. lonchbox
    Member
    Posted 2 years ago #

    Hi everybody,

    In a theme I use front-page.php template, works perfectly, code 3 different wp_query using the showcase.php template form twentyeleven as a base. And the complete theme is based on _s starter theme
    This 3 wp_query allow me to show first only 1 sticky post with thumbnail and excerpt, the second the last 4 posts with thumbnail and excerpt and the last one shows the next 4 posts but only the title. Till here, everything works perfectly, but, haven´t any idea of how to make a oldest post link, is not only a pagination is a link to the rest posts but not showing the first 9, becasue they are in the home page.

    This is the first wp_query and loop:

    [code moderated - please use the pastebin for any code over the forum limit of 10 lines]

    This is the second and the third

    [code moderated - please use the pastebin for any code over the forum limit of 10 lines]

    How should be the oldest post link?
    do I need to set a wp_query with offest=9 in the index.php ?
    The pagination code is the same as _s

    I´m completely lost, appreciate any ideas or help.

    Saludos,
    Pancho

  2. lonchbox
    Member
    Posted 2 years ago #

    Here the first loop
    And the second and third
    Sorry for the abuse of code lines :P

  3. Digital Raindrops
    Member
    Posted 2 years ago #

    In the third loop add in the argumants, 'paged' => $paged,

    HTH

    David

  4. lonchbox
    Member
    Posted 2 years ago #

    Hi David,

    Don´t work :( may be I´m doing something wrong, this is how I add the paged arguments.

    // Get the page as an Object
    					$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    					$orecent_args = array(
    						'posts_per_page' => 4,
    						'offset' => 4,
    						'post__not_in'  => get_option( 'sticky_posts' ),
    						'public' => true,
    						'ignore_sticky_posts' => 1,
    						'post_type' => 'post',
    						'paged' => $paged
    					);
    
    					// Our new query for the Recent Posts section.
    					$orecent = new WP_Query( $orecent_args );
    
    					// For all other recent posts, just display the title and comment status.
    					while ( $orecent->have_posts() ) : $orecent->the_post(); ?>
    
    						<li class="entry-title">
    							<h4><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'lonchpress' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h4>
    							<!--<span class="comments-link">
    								<?php comments_popup_link( '<span class="leave-reply">' . __( 'Deja un comentario', 'lonchpress' ) . '</span>', __( '1 comentario', 'lonchpress' ), __( '% Comentario', 'lonchpress' ) ); ?>
    							</span>-->
    						</li>
    					<?php
    					endwhile;
    					// If we had some posts, close the <ul>
    					if ( $recent->post_count > 0 )
    						echo '</ul>';
    					?>
    					<?php Lonchpress_content_nav( 'nav-below' ); ?>

    Thanx for the help :)

Topic Closed

This topic has been closed to new replies.

About this Topic