Archived topic
Custom navigation on CPT
20 replies · Started by Michele on February 27, 2019
Hi there,
based upon what Tom was saying can you try removing the true / false arguments.
e.g
get_previous_post();
get_next_post();
David, now the custom navigation is back on the normal posts, but still missing in cpt :(
OK think this is because the get_posts() function defaults to the post post type.
To test this we can try adding the post_type argument. In the PHP you will find two instances of:
$args = array(
'posts_per_page' => 1,
'include' => $prevPost->ID,
);
Add the additional argument with your post_name so its like this:
$args = array(
'posts_per_page' => 1,
'include' => $prevPost->ID,
'post_type' => 'YOUR-POST-TYPE-NAME-HERE'
);
I still think the category argument will cause an issue so leaving them as stated here should be the left as is:
https://generatepress.com/forums/topic/custom-navigation-on-cpt/page/2/#post-826332
Update:
Save your existing PHP snippet somewhere, and try this one instead:
https://gist.github.com/diggeddy/49ff70777b16bee5e21081a110fe456d
You guys rock! Thanks David & Tom for your time: it works like a charm >
https://www.graffette.net/case-history/okra/
Awesome :) That looks really cool!
Glad we could be of help.