WordPress.org

Ready to get started?Download WordPress

Forums

Jetpack by WordPress.com
[resolved] Filter Sharing Buttons In Minileven Theme (3 posts)

  1. Liltiger
    Member
    Posted 1 year ago #

    Hi Guys,

    Thanks for the update! I decided to give the mobile version a try, but was wondering how to disable the Sharing buttons from the mobile theme. I want to echo the sharing display on to the top of the post instead of the bottom.

    What additional filter will I need to add to this in my functions? Perhaps there can be an option to choose the top of the post or bottom in future updates?

    function jptweak_remove_share() {
    	remove_filter( 'the_content', 'sharing_display',19 );
    	remove_filter( 'the_excerpt', 'sharing_display',19 );
    }
    add_action( 'loop_end', 'jptweak_remove_share' );

    Many Thanks In Advance!

    http://wordpress.org/plugins/jetpack/

  2. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 1 year ago #

    You can use the same filters, but you will need to apply them only if you're on mobile.

    You can build a small plugin for that, and use the following code:

    // Check if we are on mobile
    function jetpackme_is_mobile() {
    
        // Are Jetpack Mobile functions available?
        if ( ! function_exists( 'jetpack_is_mobile' ) )
            return false;
    
        // Is Mobile theme showing?
        if ( isset( $_COOKIE['akm_mobile'] ) && $_COOKIE['akm_mobile'] == 'false' )
            return false;
    
        return jetpack_is_mobile();
    }
    
    // Let's remove the sharing buttons, but only if we're on a mobile device
    function jetpackme_maybe_add_filter() {
    
        // On mobile, and on the home page?
        if ( jetpackme_is_mobile() ) {
            remove_filter( 'the_content', 'sharing_display',19 );
    		remove_filter( 'the_excerpt', 'sharing_display',19 );
        }
    }
    add_action( 'wp_head', 'jetpackme_maybe_add_filter' );
    
    // Build the function
    function jptweak_remove_share() {
    	remove_filter( 'the_content', 'sharing_display',19 );
    	remove_filter( 'the_excerpt', 'sharing_display',19 );
    }

    You can find out more about how to customize the mobile theme here:
    http://jetpack.me/2013/06/27/customize-mobile-theme/

  3. Liltiger
    Member
    Posted 1 year ago #

    Oh I see now. Awesome, thanks a bunch!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.