-
AuthorPosts
-
October 30, 2015 at 11:00 am #527285
Hello!
My client want’s to have the previous and next portfolio links inside de page, like this image: http://giselabreu.com/next-previous.jpg
Can you point me the away to do this, maybe with code block.
Thanks.Gabreu
October 31, 2015 at 11:30 pm #528009Hello,
This would require some custom work, fortunately WordPress has built-in functions that could help you with this:
http://codex.wordpress.org/Function_Reference/previous_post_link
http://codex.wordpress.org/Function_Reference/next_post_linkYou could wrap them in a shortcode and then paste it on a Text Block or similar.
Best regards,
JosueNovember 1, 2015 at 12:44 am #528026Hi Josue,
Thank you for your answer.
I don’t understand most of technical words, what do you mean by wrap a function in a shortcode?Thanks
GabreuNovember 1, 2015 at 1:29 am #528031Check this link:
http://wordpress.stackexchange.com/questions/12904/making-a-shortcode-next-and-previous-to-place-into-specific-posts-for-post-nRegards,
JosueNovember 1, 2015 at 7:32 pm #528160Hi Josue!
Yessss i did it! It’s working! It took a while because i do not have much experience with PHP, and my english is not so good, but i did it.
I have to say thank you for this.I also have one task left to finish this site. I have already start a topic few days ago, but have no answer.
I really appreciate your help again. Can we keep talking here or should i guide you to the topic?Best Regards,
Gabreu
November 2, 2015 at 12:02 am #528191Glad to hear that, i’ll check your other topic.
Best regards,
JosueNovember 3, 2015 at 3:08 am #528950Hi Josue, i’m sorry to bore you again with this issue.
As i told you the previous and next post is working in the site, but now i have another relating issue.
I need that it works only in the same category. I followed the codex.wordpress.org instructions but no results.
So the code i have in functions.php is this, and as i told you is working:add_shortcode( ‘prev’, ‘prev_shortcode’ );
add_shortcode( ‘next’, ‘next_shortcode’ );
function next_shortcode($atts) {
global $post;
ob_start();
next_post_link( ‘<div class=”nav-next”>%link</div>’, ‘Next project’ );
$result = ob_get_contents();
ob_end_clean();
return $result;
}function prev_shortcode($atts) {
global $post;
ob_start();
previous_post_link( ‘<div class=”nav-previous”>%link</div>’, ‘Previous project’ );
$result = ob_get_contents();
ob_end_clean();
return $result;
}Can you help again?
Regards
GabreuNovember 5, 2015 at 2:25 am #530479Have you tried passing
true
as the third parameter here?next_post_link( ‘<div class=”nav-next”>%link</div>’, ‘Next project’, true);
Regards,
JosueNovember 5, 2015 at 3:04 am #530483Hey, i’ve tried that and the link disappears from portfolio page.
Regards
GabreuNovember 5, 2015 at 3:18 pm #530818Hi!
Make sure the portfolio items and its taxonomies are properly set, if the links disappear when you enable the
in_same_term
parameter then it means there is no other portfolio items within that category.Cheers!
JosueNovember 6, 2015 at 12:07 pm #531408Hi!
I did some research and tried to read and learn something to get this working, but i don’t know how to manage this.
I have some portfolio projects with several categories that i set. I gave the portfolio projects is respective categories.
They are working under the menus, if you get a look to the site you will see that.
I really don’t know what else to do, i don’t have the knowlegde to resolve this, there must be something that i’m missing.I just want to say thanks for your help.
Best Regards.
Gabreu
November 9, 2015 at 1:16 pm #532534Glad to hear that, let us know if you need further assistance.
Best regards,
Josue -
AuthorPosts
- You must be logged in to reply to this topic.