[Support request] Custom navigation on CPT

Home Forums Support [Support request] Custom navigation on CPT

Home Forums Support Custom navigation on CPT

  • This topic has 20 replies, 3 voices, and was last updated 5 years ago by David.
Viewing 6 posts - 16 through 21 (of 21 total)
  • Author
    Posts
  • #826332
    David
    Staff
    Customer Support

    Hi there,

    based upon what Tom was saying can you try removing the true / false arguments.

    e.g

    get_previous_post();

    get_next_post();

    #826340
    Michele

    David, now the custom navigation is back on the normal posts, but still missing in cpt ๐Ÿ™

    #826379
    David
    Staff
    Customer Support

    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

    #826669
    David
    Staff
    Customer Support

    Update:
    Save your existing PHP snippet somewhere, and try this one instead:

    https://gist.github.com/diggeddy/49ff70777b16bee5e21081a110fe456d

    #826694
    Michele

    You guys rock! Thanks David & Tom for your time: it works like a charm >
    https://www.graffette.net/case-history/okra/

    #827197
    David
    Staff
    Customer Support

    Awesome ๐Ÿ™‚ That looks really cool!
    Glad we could be of help.

Viewing 6 posts - 16 through 21 (of 21 total)
  • You must be logged in to reply to this topic.