• Resolved darrencss

    (@darrencss)


    Is there a way to activate Jetpack Sharing without the buttons activating on every single post?

    The reason I ask is that I only want the buttons on a single category. As it stands, to achieve this I would need to manually edit 500 + posts to untick the option box.

    Thanks

    https://wordpress.org/plugins/jetpack/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter darrencss

    (@darrencss)

    Ok, it looks like the ideal way to do this with a conditional tag:
    is_category( ” );

    Something like this maybe?

    //* Only show sharing buttons on category 53
    function jptweak_remove_share() {
        if ( is_category( '53' ) ) {
            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' );
    Thread Starter darrencss

    (@darrencss)

    I managed to do this by playing with the moving sharing icons code found here:
    http://jetpack.me/2013/06/10/moving-sharing-icons/

    However, what I really wanted to achieve is for the module script and css not to load on every post whether sharing was selected or not.

    I found that by creating a custom post type I can select this post type as an option in the sharing settings which gives me the granular control I was looking for.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    what I really wanted to achieve is for the module script and css not to load on every post whether sharing was selected or not.

    Another option would be to check the box appearing at the bottom of the sharing settings screen to remove all sharing resources from your site, and then enqueue them back manually, only on the pages you want. You can read more about this here:
    https://jetpack.me/2013/05/03/custom-sharing-libraries/

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Deselect 'Show sharing buttons' by default’ is closed to new replies.