Cyber Week Sale! Get $20 off GP Premium, $40 off our new Lifetime license, and 45% off license renewals/extensions! Learn more

[Resolved] wordpress sharing icons

Home Forums Support wordpress sharing icons

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #168141
    Tony

    I know it’s not a Generatepress issue but I’ll ask:
    I hate white space and would like to move the ‘Like’ button up alongside the ‘share’ buttons or at least do something like that.

    I found a Jetpack support article from 2013 that may still apply.
    https://jetpack.me/2013/06/10/moving-sharing-icons/

    There are two methods and I have copied the info below. Method 2 looks easier but I don’t know about jQuery so don’t know where I’d put the code.

    For method 1 I know how to edit the functions.php file but I’m not sure where to put the other code. Can (will) you help when you’ve time?
    I imagine, other people would like to do this too.
    ———————————————-
    Method 1:
    In your functions.php file, add the following:

    function jptweak_remove_share() {
    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’ );

    Find the file for the location where you’d like the sharing icons to appear and insert the following code in the area you want the Sharing or Likes buttons to appear:

    if ( function_exists( ‘sharing_display’ ) ) {
    sharing_display( ”, true );
    }

    if ( class_exists( ‘Jetpack_Likes’ ) ) {
    $custom_likes = new Jetpack_Likes;
    echo $custom_likes->post_likes( ” );
    }
    Note that you do not need to display these together; you can put sharing_display() in a separate place from the Likes display codeblock.
    ————————————————————-
    Method 2:
    This method comes via Beau Lebens, a fellow Automattician. He coded this jQuery method for moving the Sharing icons:

    jQuery( document ).ready( function( $ ) {
    // Relocate Jetpack sharing buttons down into the comments form
    jQuery( ‘#sharing’ ).html( jQuery( ‘.sharedaddy’ ).detach() );
    } );
    The #sharing selector is just the DOM location where I want to move the buttons to, and the .sharedaddy one is the container that Jetpack places its buttons in normally. We just detach it from the normal position and then dump it into the new location exactly as it was.

    #168161
    Tom
    Lead Developer
    Lead Developer

    I’m afraid I’m not familiar enough with Jetpack to give you a good answer.

    However, they have a whole support team who should be able to help you – have you tried posting in their forum?

    #168173
    Tony

    I will try – no problem. Thanks for looking.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.