Support » Fixing WordPress » Can't get WP-Paginate to work on single.php

  • Resolved catalpha


    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')) {
    } ?>

    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,

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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.

    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')) {
    } ?>

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Can't get WP-Paginate to work on single.php’ is closed to new replies.