Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #12072

    I would like to have a previous/next entry link in Portfolio-single to show only entries in the same portfolio category. Can you help me with that?

    #74153

    In includes/loop-portfolio-single.php replace following code:

    <div class='previous_post_link_align'>
    <?php previous_post_link('<span class="previous_post_link">&larr; %link </span><span class="post_link_text">'.__('(previous entry)','avia_framework'))."</span>"; ?>
    </div>
    <div class='next_post_link_align'>
    <?php next_post_link('<span class="next_post_link"><span class="post_link_text">'.__('(next entry)','avia_framework').'</span> %link &rarr;</span>'); ?>
    </div>

    with:

    <div class='previous_post_link_align'>
    <?php previous_post_link('<span class="previous_post_link">&larr; %link </span><span class="post_link_text">'.__('(previous entry)','avia_framework'),'',TRUE)."</span>"; ?>
    </div>
    <div class='next_post_link_align'>
    <?php next_post_link('<span class="next_post_link"><span class="post_link_text">'.__('(next entry)','avia_framework').'</span> %link &rarr;</span>','',TRUE); ?>
    </div>

    #74154

    Hmm. I did that and now the whole text is missing. The firebug shows that div.previous_post_link_align and div.next_post_link_align are still there, but nothing is showing up. You can see it on: http://www.krdelo.si/portfolio/kuki

    #74155

    Hello,

    Try to replace it with this.

    <div class='previous_post_link_align'>
    <?php previous_post_link('%link', Previous', true); ?>
    </div>
    <div class='next_post_link_align'>
    <?php next_post_link('%link', Next', true); ?>
    </div>

    Hope it works.

    Regards,

    Ismael

    #74156

    Hello!

    Ismael the code you provided is the same as in the WordPress Codex Function Reference/previous post link (but it’s missing two ‘ so it makes an error which I fixed), but it’s still not working. Nothing shows in the divs, they are blank.

    I did it gradually, removing first the text ‘Previous’ – everything was fine, then adding TRUE statement -> everything in the div disappears when I add TRUE. I even added the desired category ID at the end, but nothing helps.

    I was thinking maybe it’s not working because it’s a portfolio item post not the normal WordPress post… I don’t know.

    #74157

    Can anyone help? Why is the basic WordPress Codex Function Reference previous/next post link not working?

    #74158

    Hi,

    You’re probably right – it may have something to do with the custom post type because it uses taxonomy/terms instead of categories. I tried several variations of the code but I couldn’t get it to work with portfolio items too. I’ll ask Kriesi to look into this because this would require a custom function. I can’t promise that he’ll add this feature though.

    #74159

    Ok, I understand.

    #74160
    #74161

    to be perfectly honest, I am also not sure if this can be done with ease. The suggested thread certainly is a starting point but it is never a good idea to use self written database queries with wordpress, since every new release might change the structure of the query class or the database.

    I am afraid until wordpress offers a more streamlined way to do this we are stuck with the default post navigation here :/

Viewing 10 posts - 1 through 10 (of 10 total)

The topic ‘Portfolio previous/next entry in same category’ is closed to new replies.