Sharedaddy (jetpack) share button modifications

Community Forums Forums Design Tips and Tricks Sharedaddy (jetpack) share button modifications

This topic is: not resolved

This topic contains 4 replies, has 2 voices, and was last updated by  jgk 1 year, 3 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #48442

    jgk
    Participant
    Post count: 25

    Hi!

    I’m using Jetpack’s “share daddy” sharing buttons and I’m trying to make some modifications.

    I’m trying to get the sharedaddy buttons to appear on the top & bottom of the post on the individual blog post pages, but I only want the sharedaddy buttons to appear on the bottom of the post (after the excerpt) on the blog page.

    In an attempt to do this I’ve added the following code to my functions.php page in the child theme:

    //* Add Jetpack share buttons above post
    remove_filter( 'the_content', 'sharing_display', 19 );
    remove_filter( 'the_excerpt', 'sharing_display', 19 );

    add_filter( 'the_content', 'share_buttons_above_post', 19 );
    add_filter( 'the_excerpt', 'share_buttons_above_post', 19 );

    function share_buttons_above_post( $content = '' ) {
    if ( function_exists( 'sharing_display' ) ) {
    return sharing_display() . $content;
    }
    else {
    return $content;
    }
    }

    But the sharedaddy buttons are still appearing on the top & bottom of the blog page before and after the excerpt.

    Any ideas on removing the sharedaddy above the posts on the blog page but leaving them above the post on single post pages?

    http://studioissa.com/blog/
    #48450

    braddalton
    Participant
    Post count: 10157

    Please clarify your question.


    #48457

    jgk
    Participant
    Post count: 25

    I have mysite.com/blog/ & mysite.com/blog/a-single-post/

    mysite.com/blog/ shows small excerpts and several posts.

    I’d prefer to only show the sharedaddy sharing buttons below the post excerpt only. Right now its showing above the excerpt and below the excerpt.

    but on mysite.com/blog/a-single-post/
    I’d like the sharedaddy sharing buttons to still be at the top of the post (as they are) and below the post (as they are). No change necessary.

    Thanks so much brad. I couldn’t find any instructions for this.

    as you can see here:

    http://studioissa.com/blog/

    having sharing buttons before and after the rather short excerpts is excessive & a bit spammy.

    #48463

    braddalton
    Participant
    Post count: 10157

    Here’s the code you can add in your child themes functions.php file

    The hook position can be changed and you can also add a conditional tag.

    Example:
    [php]
    if ( function_exists( ‘sharing_display’ ) && is_archive() ) {
    [/php]

    You will need to modify this code to suit your needs.


    #48476

    jgk
    Participant
    Post count: 25

    Thanks again Brad! That worked.

    Cheers, Jay

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.