Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Contributor Jeff Golenski

    (@maverick3x6)

    Sturminator10,

    Just curious, but have you tried using the Related Posts feature that’s already built into Jetpack?

    If you utilize the “Related Posts” feature that Jetpack already has, your social buttons will automatically sit above the related posts. Then you won’t have to have so many plugins installed, which is a good thing.

    Here’s an example on the Jetpack site:

    Screen Shot

    (You can keep the same style of social buttons you have now, we just use a different style on our site)

    Thread Starter Sturminator10

    (@sturminator10)

    Thanks Jeff – I stopped using that function because it didn’t give me the ability to choose which specific articles to display as being related.

    Plugin Contributor Jeff Golenski

    (@maverick3x6)

    No worries, I understand. Is there a URL of your site that I can check out to see the site live?

    Plugin Contributor Jeff Golenski

    (@maverick3x6)

    Totally understand! So by default, our sharing icons are placed directly after the content of a post or page. But that other related posts plugin (by zenmanta) is sneaking in between our sharing buttons and your post content.

    So what you’re probably going to have to do is find out how to move the related posts below our sharing icons (and not move our sharing icons above the related posts).

    Here’s some documentation on how to move our sharing icons around, anyway.

    The issue that either way, you’re probably going to need to do some coding in the functions.php file, which requires a bit of technical knowledge.

    Do you have a URL so I can see the live site in action?

    Thread Starter Sturminator10

    (@sturminator10)

    Thanks for all this info. Here’s an article for example.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    As Jeff mentioned, you will indeed need to dive into code to fix this. I explained a bit how different plugins hook data at the bottom of your post content in this thread:
    https://wordpress.org/support/topic/page-numbers-above-share-this?replies=3&view=all#post-7951897

    In your case, Zemanta is most likely hooking its Related Posts at a priority lower than 19, that Jetpack uses.

    You’ll consequently need to remove Jetpack’s Sharing buttons from their default location, and add them again at a lower priority, so they get displayed above the related posts.

    To get started, add the following code to a functionality plugin:

    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' );

    That will remove the buttons from their default location.

    Then, add the following code to add the buttons back, at a priority of 1:

    function jeherve_add_buttons_back( $content ) {
    	if ( function_exists( 'sharing_display' ) ) {
    	    $shares = sharing_display( '', false );
    	} else {
    	    $shares = '';
    	}
    
    	if ( class_exists( 'Jetpack_Likes' ) ) {
    	    $custom_likes = new Jetpack_Likes;
    	    $likes = $custom_likes->post_likes( '' );
    	} else {
    	    $likes = '';
    	}
    
    	return $content . $shares . $likes;
    }
    add_filter( 'the_content', 'jeherve_add_buttons_back', 1 );

    That should solve your issue, unless Zemanta Related Posts are also hooked at a priority of 1.

    I hope this helps.

    Thread Starter Sturminator10

    (@sturminator10)

    Super close, Jeremy!

    I did this, which resulted in this.

    So now I just need to get the sharing buttons in between the StarBox plugin (my author box) and the Related Posts!

    I’d really appreciate any more help you can give.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    That shouldn’t be too hard. Do you see the number 1 on the last line of code you’ve added? That’s the priority at which I inserted the Jetpack buttons.

    Since we don’t know the priority of the StarBox plugin and the Zemanta Related Posts, you’re going to have to play a bit with that number. Start changing it to 2, then 3, … When the buttons move to after the StarBox plugin, you’ll know that you’ve reached the priority used by that plugin. 🙂

    Let me know how that goes.

    Thread Starter Sturminator10

    (@sturminator10)

    Having some weird results. At priority 9, it’s still placed first. But then, if I increase it to 10, it somehow goes all the way to the bottom, below Related Posts!

    Did I insert the code wrong?

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    You did it right, but it’s possible that both StarBox and Zemanta insert their content at priority 9. Jetpack starting with the letter J, it gets loaded before StarBox and Zemanta when all three plugins use the same priority. So you’d have no way to insert the sharing buttons between the 2 plugins.

    To solve this issue, you’ll need to contact one of the plugin authors, and ask them how to move their content like you’ve just done with Jetpack’s sharing buttons. Once you know how to do it with one of the other plugins, you’ll be able to set 3 different priorities in the order you prefer.

    I hope this helps.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Reorder the Jetpack Social buttons’ is closed to new replies.