If you use a block theme, you no longer need to use the code snippets below to customize the location of the sharing buttons on your site. You can use the Sharing buttons block to place the buttons anywhere you’d like in your theme.
One of the most common requests you send us is « Can we move the Sharing and Like buttons? » By default, the Sharing and Like buttons get printed at the end of the the_content() Loop function, which causes them to display at the end of your post’s text — but that may not be where you want them in your site’s design.
There are actually two ways to move the Sharing buttons and one for the Like button.
Move the Sharing and Like buttons
Jetpack, by default, just attaches this tag to two filters — the_content() and the_excerpt() — so that the Sharing icons get displayed. By editing your theme files, you can move the tag wherever you’d like — we default to attaching it to the filters so that, when the Sharing and Likes modules are activated, the buttons are displayed with no extra work. You’re free to move it around to put the Sharing icons where you’d like; here’s how:
In your functions.php file, add the following:
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' );
Find the file for the location where you’d like the sharing icons to appear and insert the following code in the area you want the Sharing or Likes buttons to appear:
if ( function_exists( 'sharing_display' ) ) {
sharing_display( '', true );
}
if ( class_exists( 'Jetpack_Likes' ) ) {
$custom_likes = new Jetpack_Likes;
echo $custom_likes->post_likes( '' );
}
Note that you do not need to display these together; you can put sharing_display() in a separate place from the Likes display codeblock.
Move the Sharing Buttons via jQuery
This method comes via Beau Lebens, a fellow Automattician. He coded this jQuery method for moving the Sharing icons:
jQuery( document ).ready( function( $ ) {
// Relocate Jetpack sharing buttons down into the comments form
jQuery( '#sharing' ).html( jQuery( '.sharedaddy' ).detach() );
} );
The
#sharingselector is just the DOM location where I want to move the buttons to, and the.sharedaddyone is the container that Jetpack places its buttons in normally. We just detach it from the normal position and then dump it into the new location exactly as it was.
We hope this helps you develop your theme and display things the way you like.
Keep reading.
The latest from the Jetpack blog.
Is the WordPress MCP server slow? I timed 160 calls on my own site.
I asked ChatGPT and Claude if Jetpack's MCP server is slow. Both said yes, and both pointed to the same test, one that put five everyday…
3 min de lecture
Everything that keeps your site safe, now on one page
Jetpack 16.4 brings Scan, Firewall, Login protection and Downtime monitoring together on one Protect page in wp-admin, so you can see whether your site is safe…
4 min de lecture
Jetpack 16.4 release: One Protect page, a new Backup dashboard, and more
All of Jetpack's security on one Protect page, a rebuilt Backup dashboard, Trim & cut for VideoPress, a new comment form, and the new Jetpack Pro…
3 min de lecture
Gérez votre site WordPress, l’IA d’abord.
Free to start, and AI agents are free to connect. Money back within 14 days on yearly plans.


