Forums

$prev_link and $next_link not working? (3 posts)

  1. rcwatson
    Member
    Posted 1 year ago #

    Hi all,

    I have the following code in a category template (category-1844.php) to display only posts in that category.

    <?php /* If this is a category archive */ if (is_category()) { ?>
    <h2 class="pagetitle"><?php printf(__('%s Archive', 'kubrick'), single_cat_title('', false)); ?></h2>
    
    <?php if ($prev_link || $next_link): ?>
    <div class="navigation">
    			<div class="alignleft"><?php echo $next_link; ?></div>
    			<div class="alignright"><?php echo $prev_link; ?></div>
    </div>
    <?php endif; ?>

    However, the previous and next links are not appearing. There are 44 posts in this category and I'm displaying 10 posts per page. But I can't access the older posts because the previous link system doesn't seem to work on this category template. This happens on templates I've set up for other categories as well. What might I be doing wrong or leaving out?

    Thanks.

  2. alchymyth
    The Sweeper
    Posted 1 year ago #

    where are the variables $prev_link and $next_link defined?

    shouldn't be there some code somewhere earlier in the template file, like:

    <?php
    $prev_link = get_previous_posts_link();
    $next_link = get_next_posts_link(();
    ?>

    http://codex.wordpress.org/Function_Reference/previous_posts_link
    http://codex.wordpress.org/Function_Reference/next_posts_link

  3. rcwatson
    Member
    Posted 1 year ago #

    Ah! That's what it was! Thank you. It was driving me crazy.

Topic Closed

This topic has been closed to new replies.

About this Topic