Hi all,
I have a problem with Post Navigation which I’ve search for a solution and I cannot resolve it π
I display 8 posts from same category in a page using the plugin Custom Content Shortcode:
[loop type="post" category="home-images" count="8" columns="4" pad="0px 10px"][field image-link][field title-link class="center_title"][/loop]
When i click in each post I enter in the detail, so in single page post.
I have tried to use previous_post_link and next_post_link with parameter $in_same_term = true but it gets posts from other categories.
I’ve done it but overriding twentythirteen_post_nav() function in my child theme and I’ve also tried to make a shortcode to get it:
/* Shortcode to navposts on post pages */
function create_navposts() {
ob_start();
?>
<?php previous_post_link('%link', 'Prev', TRUE); ?>
<?php next_post_link('%link', 'Next', TRUE); ?>
<?PHP
return ob_get_clean();
}
add_shortcode('navposts', 'create_navposts');
but it always loose the category reference and I get posts from other categories.
What should I do to get the reference of the category and navigate only inside posts from same category?
Thanks for your help
Hugo