WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Restrict Navigation Links to current category (4 posts)

  1. yorokobi
    Member
    Posted 7 years ago #

    In my Theme, I currently have the following:

    <div class="navigation">
    	<div class="alignleft"><?php previous_post_link('&laquo; %link') ?></div>
    	<div class="alignright"><?php next_post_link('%link &raquo;') ?></div>
    </div>

    What I want to do is add conditional statements that will get and display links ONLY to the "back" or "next" post in the SAME category.

  2. alakhnor
    Member
    Posted 7 years ago #

    You could have found it here by yourself: http://codex.wordpress.org/Template_Tags/previous_post_link

    <div class="navigation">
    	<div class="alignleft"><?php previous_post_link('&laquo; %link', '', true) ?></div>
    	<div class="alignright"><?php next_post_link('%link &raquo;, '', true') ?></div>
    </div>
  3. yorokobi
    Member
    Posted 7 years ago #

    Your assuming I didn't look. tsk tsk. I did, but I did not find that resource. Thanks for pointing it out.

  4. Deepanshu Goel
    Member
    Posted 6 years ago #

    @ alakhnor - Thank you very much

    @ yorokobi - Close this topic as its resolved

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags