• Resolved mickwarnes

    (@mickwarnes)


    In Twentyten the existing code does the right thing, but I would like to add the category name to the newer and older links, the code is this <?php next_posts_link( __( ‘Older’, ‘twentyten’ ) ); ?>
    I have managed to do this but only for the next and previous posts as opposed to page, I did this with next_post_link instead of next_posts_link <?php next_post_link(‘%link »’,’Next in ‘.$cat_name,TRUE, ”) ?>
    I have tried to transpose this, but without success. What does the ‘twentyten’ do within the code? And does anyone now how to add the category name to the older and newer links?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter mickwarnes

    (@mickwarnes)

    Sorry, just worked out that the structure of next_posts_link is very different to next_post_link and have worked it out.

    <?php next_posts_link( $label , $max_pages ); ?>

    But I still wouldn’t mind knowing what ‘twentyten’ does?

    Refer to the Codex entry for next_post_link().

    The syntax is as follows:

    next_post_link( $format, $link, $in_same_cat, $excluded_categories );

    The next_posts_link() function doesn’t need (or accept) any category-related arguments. As you noted, you *can* change the label.

    In your category.php template file (or, inside of a if ( is_category() ) conditional), do something like the following:

    $paginationlabel = single_cat_title();
    next_posts_link( $paginationlabel );

    Thread Starter mickwarnes

    (@mickwarnes)

    Thanks Chip

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add category name to next and previous links in Twentyten’ is closed to new replies.