WordPress.org

Forums

Jetpack by WordPress.com
[resolved] Disable sharing in custom post template? (6 posts)

  1. doctorproctor
    Member
    Posted 3 years ago #

    Greetings -- We have disabled "Show sharing buttons on" for a certain custom post type in Jetpack > Sharing Settings, but they still appear as this custom post type includes excerpts of regular posts (for which sharing is enabled). It's annoying, as the sharing buttons appear under each post excerpt!

    Is there a shortcode or other solution I could add to the template for this custom post type to disable sharing buttons?

    Thanks,

    Jim P.

    http://wordpress.org/extend/plugins/jetpack/

  2. Quincunx
    Member
    Posted 3 years ago #

    I have a related problem or the same one:

    I have the Sharing button enabled just for single posts pages, but on my theme (Futurosity Magazine) there are some excerpts on the top of every single post. Under EVERY EXCERPT of them appears a button too. Is there any way to fix this?? On other pages, where I disabled the Sharing button, the excerpts show up properly.

    My web is http://www.quincunx.es

    Thanks.

  3. Tim Moore
    Moderator
    Plugin Contributor

    Posted 3 years ago #

    You could try adding the following to your functions.php in your theme:

    remove_filter( 'the_excerpt', 'sharing_display', 19 );

    Be aware that this will remove sharing buttons from ALL excerpts on your site.

  4. doctorproctor
    Member
    Posted 3 years ago #

    Thanks; somehow it didn't work. Btw, in my case excerpts (in e.g. the default blogroll page) are not showing the share buttons. Any additional ideas?

    Jim

  5. ayepod
    Member
    Posted 2 years ago #

    Hi, I'm currently finding the exact same issue. Tim, can you explain your code further?

    Adding this into functions.php like this doesn't do anything for me.

    Also, what does the '19' signify?

    Thanks, Alistair

  6. Tim Moore
    Moderator
    Plugin Contributor

    Posted 2 years ago #

    Try this in an mu-plugin file or in your theme's functions.php:

    add_action( 'init', 'my_remove_filters_func' );
    
    function my_remove_filters_func {
         remove_filter( 'the_excerpt', 'sharing_display', 19 );
    }

    @ayepod: the 19 signifies the priority the original filter was added at. When removing the filter, you need to specify the same priority or the removal won't work.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Jetpack by WordPress.com
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic