• I know that I posted this question earlier today in another forum but discovered later that there are also forums for plugins.

    So here’s my question:
    How can I make share buttons appear immediately below my post?

    I installed the plugin, set up the share buttons, and the order of divs on my website is now:
    – post
    – About the author box
    – Related posts
    – Share buttons
    – Comments

    However, I want to have the share buttons before the ‘about the author’ box.

    So the order should be:
    – Post
    – Share buttons
    – About the author box
    – Related posts
    – Comments

    Note: I don’t know anything about PHP and my CSS skills are quite basic. If there’s anybody who can give me a code that I can put in the editor, I would be very happy ??

    Kamila

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author micropat

    (@micropat)

    The order of things in content is based on “priority” numbers, so you can either change the priority number of AddToAny, or find out how to change your Related Posts section’s priority.

    To change AddToAny’s priority, it’s best to add the following PHP code using a “functionality” plugin such as the Code Snippets plugin:

    // Make AddToAny standard share buttons appear above my related posts
    function addtoany_before_my_related_posts( $query ) {
        remove_filter( 'the_content', 'A2A_SHARE_SAVE_add_to_content', 98 );
        
        if ( $query->is_main_query() && is_singular() ) {
            add_filter( 'the_content', 'A2A_SHARE_SAVE_add_to_content', 39 );
        }
    }
    add_action( 'pre_get_posts', 'addtoany_before_my_related_posts' );

    Lower the 39 priority number in the code as needed to make the buttons appear earlier than your related posts section. It’s a bit of a guessing game. ??

    Thread Starter kamilapolyglotsdiary

    (@kamilapolyglotsdiary)

    @micropat makes sense, thanks for your explanation!

    Using the snippet with your code doesn’t have an effect so I’ll ask in another forum how I can lower the priority number of the related posts plugin.

    Thanks again!

    Plugin Author micropat

    (@micropat)

    Hmm… the site currently has some other plugin’s buttons in that area, not AddToAny’s. That would explain why the above isn’t working for you yet!

    Settings > AddToAny > “Placement” to re-enable the standard share buttons on your posts.

    And just change 39 to 9 in the above code, like:

    add_filter( 'the_content', 'A2A_SHARE_SAVE_add_to_content', 9 );

    Hi, similar problem here. Even with the 39 set to “1”, the Share icons still appear AFTER the post content on this page.

    I would really like them to appear above the content as on the rest of the site.

    Many thanks,
    Phil

    Thread Starter kamilapolyglotsdiary

    (@kamilapolyglotsdiary)

    @micropat @carryoncoding

    I already see what the problem is… Apparently, I’m using two different plugins to share posts. When I enable the option @micropat mentioned, I do see the share buttons immediately below the post. However, the one that is appearing below related posts is another plugin with a similar same (AddThis).

    I’ll ask it further on AddThis’s forum. Thanks for your help!

    Thanks Kamila, I’ll start a new thread and cross-reference this one.
    Cheers,
    Phil.

    • This reply was modified 6 years, 9 months ago by carryoncoding. Reason: Add link to new thread
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Share buttons don’t appear immediately below post’ is closed to new replies.