Archived topic
Next and previous links
7 replies · Started by Matthew on December 23, 2018
Hi,
I can't figure out how to get next and previous links to appear natively with GeneratePress?
Right now I am using toolset to insert them but this creates URLs with query strings on the end for some reason.
What should I target to get them to appear? Or is there some setting I am missing?
Hi there,
You can tell GP to include the footer meta in your custom post type like this: https://docs.generatepress.com/article/generate_footer_meta_posts_types/
Let me know if that helps or not :)
Hey Tom,
Thanks for the quick reply!
Tried but this doesn't seem to do anything. :-/
Can you show me the code you added?
Hey
Yeah sure I added the following:
add_filter( 'generate_footer_meta_posts_types', function( $types ) {
$types[] = 'tv_show';
$types[] = 'tv-show';
return $types;
} );
Just to be safe as I am unsure if its tv_show or tv-show as I changed it from tv_show to tv-show.
Ah, I think that code will only work on post type archives.
Since you're using a shortcode to output posts, the pagination would need to come from the shortcode.
It looks like you're using WP Show Posts. Is the pagination option not working?
For the archive pages we are using Toolset templates.
They can do pagination but for some reason their pagination adds strange query strings on to the end of URLs, something they said is normal for Toolset.
Our last theme pagination appeared by default on CPT, is there no way to support this, add a Wordpress supported shortcode to have pagination appear from GP?
I can edit the template to add in code where it would normally appear? Just not sure what code to use.
Cheers.
You could try this function: https://codex.wordpress.org/Function_Reference/the_posts_pagination
That the core WP way to add pagination.