Site logo

Archived topic

Custom navigation on CPT

20 replies · Started by Michele on February 27, 2019

Viewing posts 16–21 of 21

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

Awesome :) That looks really cool!
Glad we could be of help.

This archived topic is closed to new replies.