WordPress.org

Ready to get started?Download WordPress

Forums

Post navigation Twenty Ten Child theme (4 posts)

  1. kab2512
    Member
    Posted 3 years ago #

    I have a question regarding post navigation. I have made a child theme of Twenty Ten and i wish for my post navigation only to show the posts from the category from which my visitors enter.

    At the moment alle posts are being showed with next and previous links.

    I can see that in earlier versions you could write something like

    <?php next_post_link('format','link','in_same_cat','excluded_categories'); ?>

    But this dosnt seems to work any more in wordpress 3.0.4
    How do i change the following code so that my visitors only can go through the posts from the category in which they enter?

    <?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '←', 'Previous post link', 'campell' ) . '</span> %title' ); ?>
    
    <?php next_post_link( '%link', '%title <span class="meta-nav">' . _x( '→', 'Next post link', 'campell' ) . '</span>' ); ?>

    Help please :-(

  2. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    http://codex.wordpress.org/Function_Reference/next_post_link

    the third parameter is the 'in_same_cat'; the current links only use two parameter, so the true to keep them in the same cat comes after the existing parameter;

    try:

    <?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '←', 'Previous post link', 'campell' ) . '</span> %title', true ); ?>
    
    <?php next_post_link( '%link', '%title <span class="meta-nav">' . _x( '→', 'Next post link', 'campell' ) . '</span>', true ); ?>
  3. kab2512
    Member
    Posted 3 years ago #

    i will defintily try that and let know if it works :-)
    Thank you for your answer

  4. kab2512
    Member
    Posted 3 years ago #

    it works like a charm :-)
    thank you for your help

Topic Closed

This topic has been closed to new replies.

About this Topic