1

Jetpack Sharing buttons settins
Typically Jetpack sharing buttons target the single page's the_content() function and echo the sharing icons just below the content. But for my site, I actually want it to Disable for the_content(), but to use it in some other <div>. I know I can check the "Disable CSS and JS" checkbox to disable the built-in functionality, but I actually don't want to code more and I like the default CSS of Jetpack sharing icons.

I simply want a Javascript code to alter the target of Jetpack so that instead of showing under the the_content() I can show it under another custom <div> of my choice.

Is it possible with any filter or hook?

P.S.: I just renamed the "Posts" to "Products" for my project. It's nothing to worry about. :)

closed as off-topic by Mark Kaplun, Pieter Goosen, birgire, mrwweb, Johannes Pille Sep 10 '14 at 15:58

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Your question should be specific to WordPress. Generic PHP/JS/HTML/CSS questions might be better asked at Stack Overflow or another appropriate site of the Stack Exchange network. Third party plugins and themes are off topic." – Mark Kaplun, Pieter Goosen, birgire, mrwweb, Johannes Pille
If this question can be reworded to fit the rules in the help center, please edit the question.

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

add_filter( 'the_content', 'share_buttons_above_post', 19 );
add_filter( 'the_excerpt', 'share_buttons_above_post', 19 );

function share_buttons_above_post( $content = '' ) {
if ( function_exists( 'sharing_display' ) ) {
    return sharing_display() . $content;
}
else {
    return $content;
}
}

Change the hook.

Related info https://wordpress.stackexchange.com/a/12826/9884

  • Thanks for the nice treasure house and the way to modify as desired. But just a little bit: How can I target it to a custom <div> of mine with its class, suppose, <div class="this_div">something custom here</div>? – Mayeenul Islam Jan 26 '14 at 16:32
  • For styling the buttons with your own CSS? – Brad Dalton Jan 26 '14 at 16:36
  • I placed 3 tabs below the single page. First one is from a plugin "Related posts Thumbnail", second one is "the content" and in third one "comments". So on the first view the sharing buttons are not visible. I want them to be visible under the first tab where the function get_related_posts_thumbnails() is showing related posts (if found any). – Mayeenul Islam Jan 26 '14 at 16:39
  • Change the hook position and/or 3rd parameter for positioning priority. – Brad Dalton Jan 26 '14 at 16:44
  • Ok. Got my answer from Matts' answer from the link you provided. Thanks for your answer. Marking as accepted. – Mayeenul Islam Jan 26 '14 at 16:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.