Support » Plugin: Jetpack - WP Security, Backup, Speed, & Growth » Share Buttons Show at the End of Loop

  • Resolved Jonathan Goldford

    (@jg-visual)


    For one of our clients the share buttons show when a blog post is displayed in a secondary loop on another page. What’s odd is that the share buttons only show on the last post within the secondary loop and the icons themselves don’t show. I imagine the icons don’t show because the icon font isn’t loaded on the secondary page.

    Do you know of a way to ensure the share icons only show on the single post’s URL and not when pulled into a loop? If it’s not possible to control that, then how can we ensure the icons show as expected?

    I’ve linked to one page where you can see an example of this.

    Thanks for the help.

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor James Huff

    (@macmanx)

    Volunteer Moderator

    Hm, that sounds a bit of scope with what we can help with here.

    Could perhaps the functions under “How can I move where the sharing icons are displayed?” at https://jetpack.com/support/sharing/#customization be of some use here?

    Thanks James. That link to https://jetpack.com/support/sharing/#customization was exactly what we needed to get this figured out. The code there allowed us to keep the sharing icons when on an individual post, but remove them when viewing an excerpt in a list of posts elsewhere.

    In case anyone needs it, here’s the code we used:

    /**
     * Hide Jetpack sharing icons when displaying excerpts.
     *
     * @see https://jetpack.com/support/sharing/#customization
     */
    function wi_hide_sharing_icons_in_excerpt() {
    
    	remove_filter( 'the_excerpt', 'sharing_display', 19 );
    }
    
    add_action( 'loop_start', 'wi_hide_sharing_icons_in_excerpt' );
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Share Buttons Show at the End of Loop’ is closed to new replies.