Home › Forums › Support › Duplicate Post Navigation in CPT This topic has 13 replies, 3 voices, and was last updated 3 years, 5 months ago by Tom. Viewing 14 posts - 1 through 14 (of 14 total) Author Posts November 17, 2020 at 9:51 am #1535068 Cris Hi I use CPT configured to show the post navigation as you indicate here. It worked fine when I did it a long time ago but now, the “previous post” and “next post” links are displayed in duplicate. Any idea why this happens? November 17, 2020 at 12:01 pm #1535199 LeoStaff Customer Support Hi there, Good question – I think that’s because we’ve included the post navigation in the footer entry meta. What happens if you remove that code? Does it remove both of them? Let me know π November 17, 2020 at 12:13 pm #1535230 Cris Hi Leo, Yes! If I delete the code, both of them disappear November 17, 2020 at 2:07 pm #1535338 LeoStaff Customer Support Can you try add this snippet as well? add_filter( 'generate_footer_entry_meta_items ', function( $items ) { if ( is_singular( 'your-post-type' ) ) { return; } return $items; } ); November 18, 2020 at 12:13 am #1535642 Cris It does not work. November 18, 2020 at 9:22 am #1536491 LeoStaff Customer Support Edited the code above. Can you give it another shot? Make sure to edit your-post-type November 18, 2020 at 12:30 pm #1536700 Cris Thanks Leo but it doesn’t work either. I don’t forget to edit “your-post-type” π November 18, 2020 at 1:58 pm #1536763 TomLead Developer Lead Developer Instead of the original function you linked to, do this: add_filter( 'generate_footer_meta_post_types', function( $post_types ) { $post_types[] = 'your-post-type'; return $post_types; } ); add_filter( 'generate_footer_entry_meta_items ', function( $items ) { if ( is_singular( 'your-post-type' ) ) { return array( 'post-navigation', ); } return $items; } ); November 19, 2020 at 12:24 am #1537135 Cris Hello Tom If I replace the original, all the previous and next links disappear. If I add it after the original, there are no changes. November 19, 2020 at 9:37 am #1537932 TomLead Developer Lead Developer Can you try the updated functions?: https://generatepress.com/forums/topic/duplicate-post-navigation-in-cpt/#post-1536763 November 19, 2020 at 10:30 am #1537971 Cris Now yes, Tom! Thanks a lot. One last thing. For 2 or more CPTs, do I have to duplicate the function? November 19, 2020 at 7:34 pm #1538357 TomLead Developer Lead Developer Nope, you can do this: add_filter( 'generate_footer_meta_post_types', function( $post_types ) { $post_types[] = 'your-post-type'; $post_types[] = 'another-post-type'; $post_types[] = 'one-more'; return $post_types; } ); add_filter( 'generate_footer_entry_meta_items ', function( $items ) { $post_types = array( 'my-post-type', 'another-post-type', 'one-more' ); if ( is_singular( $post_types ) ) { return array( 'post-navigation', ); } return $items; } ); Hope this helps π November 19, 2020 at 11:54 pm #1538511 Cris Perfect! Many thanks to the whole team. You do a spectacular job. November 20, 2020 at 9:04 am #1539192 TomLead Developer Lead Developer Glad we could help π Author Posts Viewing 14 posts - 1 through 14 (of 14 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In