How to change the position of Jetpack sharing icons?

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.

Read More

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. 🙂

Related posts

1 comment

  1. 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

Comments are closed.