• Resolved sebashton

    (@sebashton)


    I know this subject has been done to death but having read all the other resolved posts I still seem to be at a loss as to get this up and working.

    What I want to happen is the previous_posts_link and next_posts_link functions to work within my custom page type loop but they do not. paged is set in the query.

    At a bit of a loss, so any help would be appreciated.

    Code: Here on pastebin

Viewing 8 replies - 1 through 8 (of 8 total)
  • what is not working?
    do you get the ‘3 / 7’ numbers?
    where are the next/prev links going to?

    a link to your site might help to illustrate the issue.

    Thread Starter sebashton

    (@sebashton)

    Hi alchymyth,

    The previous_posts_link/next_posts_link don’t recognise that there are posts to paginate to, so they don’t show up.

    Yes the page number shows up but they don’t rely on the paginated data.

    Link

    I also tried to get that right. Does it have something to do with using wp_query?

    I found this post today it may be just what you are looking for?

    //The Query
    <?php $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; ?>
    // current page times the amount you want to show per page -chapeau Justin Tadlock
    <?php $offset = ( 1 * $paged ) - 1; ?>
    <?php $args=array(‘paged’=>$paged, 'posts_per_page'=>1, 'post_type'=>'issue', 'offset' => $offset); ?>
    <?php query_posts($args); ?>
    
    //The Loop
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
    //what you want to display from the query… excerpt images etc..
    
    <?php endwhile;?>

    David

    Thread Starter sebashton

    (@sebashton)

    @adeptris && @martinleclercq

    The issue is with the use of wp_query

    replace that with query_posts and it works like a charm.

    Do you mean I have to change it in how to address the loop for the custom post type?
    How does your call for the custom post type loop then look like?

    Thread Starter sebashton

    (@sebashton)

    @martinleclercq my code now looks like this:

    $paged = ( get_query_var( 'page' ) ) ? get_query_var( 'page' ) : 1 ;
    $args = array( 'order' => 'DESC', 'orderby' => 'date', 'paged' => $paged, 'post_type' => 'issue', 'posts_per_page' => 1 );
    
    query_posts( $args );
    
    if (have_posts()) :
    
    while ( have_posts() ) : the_post();
    ...

    ah yes, that’s it. Thanks

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Custom Posts & Pagination’ is closed to new replies.