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?
Portfolio previous/next entry in same category
10 posts from 4 voices-
Posted 1 year ago #
-
In includes/loop-portfolio-single.php replace following code:
<div class='previous_post_link_align'> <?php previous_post_link('<span class="previous_post_link">← %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 →</span>'); ?> </div>with:
<div class='previous_post_link_align'> <?php previous_post_link('<span class="previous_post_link">← %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 →</span>','',TRUE); ?> </div>Posted 1 year ago # -
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
Posted 1 year ago # -
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,
IsmaelPosted 1 year ago # -
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.
Posted 1 year ago # -
Can anyone help? Why is the basic Wordpress Codex Function Reference previous/next post link not working?
Posted 1 year ago # -
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.Posted 1 year ago # -
Ok, I understand.
Posted 1 year ago # -
Hey!
Just a hint (as a starting point - see: http://wordpress.org/support/topic/navigation-between-custom-post-types and http://www.ambrosite.com/plugins/next-previous-post-link-plus-for-wordpress )
Regards,
PeterPosted 1 year ago # -
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 :/
Posted 12 months ago #
Topic Closed
This topic has been closed to new replies.














