WordPress.org

Ready to get started?Download WordPress

Forums

WP-Paginate
[resolved] Can't get WP-Paginate to work on single.php (3 posts)

  1. catalpha
    Member
    Posted 3 years ago #

    I've been able to replace

    <?php next_posts_link('&laquo; Older Entries') ?> | <?php previous_posts_link('Newer Entries &raquo;') ?>

    in index.php, archive.php, etc. with

    <?php if(function_exists('wp_paginate')) {
        wp_paginate();
    } ?>

    and it works GREAT. But, when I try to replace

    <?php previous_post_link('&laquo; %link') ?> | <?php next_post_link('%link &raquo;') ?>

    in single.php WP-Paginate doesn't work.

    I know there is some difference in php code, but I don't know what it is.

    Any ideas?

    Thank you,
    Charlie

  2. Eric Martin
    Member
    Plugin Author

    Posted 3 years ago #

    WP-Paginate was not intended to replace the prev/next post links, just the prev/next page ones.

    In the context of a single post, pagination does not make sense unless you've broken the post into multiple pages. In that case, WP already has built-in functions to handle pagination.

  3. larsemil
    Member
    Posted 3 years ago #

    I am using a custom query to list news from news category. would like to paginate those.

    <?php $wp_query = new WP_Query('category_name=nyheter&posts_per_page=1&paged='.get_query_var( 'paged' )); ?>
    
    <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    
        <a href="<?php the_permalink();?>" title="<?php the_title();?>"><?php the_title(); ?></a><br/>
    
             <?php endwhile; ?><br/>
    <?php if(function_exists('wp_paginate')) {
        wp_paginate();
    } ?>

    Allthouh it seems that single.php cannot handle the parameters sent. any ideas?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic