Archived topic
How to move pagination on multi-page posts
5 replies · Started by Keir on June 16, 2020
On my site, whenever I create a multi page post (using page-break tags/block) the pagination appears after the WP likes and my social sharing buttons which means people miss the navigation. (div.page-links)
Can I move it to before these using a code snippet? (I have the plugin)
Also, is there any way of adding next-page, previous page links? The ones you can see on the page I have linked to have been manually added using generate blocks - but this is a suboptimal solution.
Hi there,
do the WP Likes and Social Sharing plugins provide shortcodes ( or PHP functions ) to display theml?
If so you can use a Hook Element to add them to your posts:
https://docs.generatepress.com/article/hooks-element-overview/
If you select the after_content hook they will appear after the Pagination.
Post Navigation (Next / Previous) post is an option in Customizer > Layout > Blog:
Thanks for the prompt reply and the tips.
I've been able to move the social sharing buttons via shortcode - so thanks for that.
The like button looks more complicated (https://jetpack.com/2013/06/10/moving-sharing-icons/) I don't really understand php, so I would be stabbing in the dark trying to implement the code they give here.
In the meantime, I have used css to position the 'likes' in the right place using position relative. It's a bodge, but it produces the right visual effect for now.
For the Likes try this:
1. Add this PHP Snippet to your site:
function jptweak_remove_share() {
remove_filter( 'the_content', 'sharing_display', 19 );
remove_filter( 'the_excerpt', 'sharing_display', 19 );
if ( class_exists( 'Jetpack_Likes' ) ) {
remove_filter( 'the_content', array( Jetpack_Likes::init(), 'post_likes' ), 30, 1 );
}
}
add_action( 'loop_start', 'jptweak_remove_share' );
https://docs.generatepress.com/article/adding-php/
In theory that should remove the Likes button.
2. Then in your Hook Element add:
<?php
if ( class_exists( 'Jetpack_Likes' ) ) {
$custom_likes = new Jetpack_Likes;
echo $custom_likes->post_likes( '' );
}
?>
Make sure to check Execute PHP for that one
Brilliant!
That's given me lots of possibilities to play around with.
THANK YOU!
You're welcome