Moving sharedaddy buttons (in Jetpack) to the top of a post?

Basically it line 480 in sharing-service.php
where it says:

return $text.$sharing_content;

and it should be

return $sharing_content.$text;

now changing that file won’t keep your changes on updates so you can copy that function (sharing_display) to your functions.php and rename it to something different say my_sharing_display and make the change there.

Next you need to remove the filters that plugin adds and replace with your own so in your functions.php add:

//remove old
remove_filter( 'the_content', 'sharing_display');
remove_filter( 'the_excerpt', 'sharing_display');
//add new
add_filter( 'the_content', 'my_sharing_display', 19 );
add_filter( 'the_excerpt', 'my_sharing_display', 19 );

Update

the remove_filter hook is not actually removing because it’s missing the priority parameter , from the codex:

Important: To remove a hook, the $function_to_remove and $priority arguments must match when the hook was added. This goes for both filters and actions. No warning will be given on removal failure.

so change :

remove_filter( 'the_content', 'sharing_display');
remove_filter( 'the_excerpt', 'sharing_display');

to:

remove_filter( 'the_content', 'sharing_display',19);
remove_filter( 'the_excerpt', 'sharing_display',19);

Leave a Comment