Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a custom post type name->('portfolio'), with a taxonomy name ('portfolio_category'). what i want is to put next and previous link on its single page file which is single-portfolio.php. when i click either of the links it should redirect to the next or previous post in the same post type and in the same taxonomy term.

i used next_post_link() and previous_post_link() but it seems that it only works in single post but not in single custom post type..

please.. any idea guys.. any help will greatly appreciated..

share|improve this question
add comment

3 Answers

This is what i use on my own site in my child themes functions file however you will need a theme which includes hooks or you will need to modify the code and use it in your single.php file.

    function wpsites_npp_navigation_links() {
    if( 'portfolio' == get_post_type() && is_single() ) {?>
    <?php previous_post('&laquo; &laquo; %', 'Previous', 'no'); ?>
     | <?php next_post('% &raquo; &raquo; ', 'Next', 'no'); ?>
    <?php
    } }

    add_action('genesis_entry_footer', 'wpsites_npp_navigation_links', 5 );
share|improve this answer
add comment

I can recommend the following plugin:

http://www.ambrosite.com/plugins/next-previous-post-link-plus-for-wordpress

I'm using it with 3.5.x without any problems.

share|improve this answer
add comment

I found this with a little search: http://designrjc.com/fix-previous_posts_link-and-next_posts_link-for-custom-post-types/

Hope it helps you.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.