Support » Plugin: Jetpack by WordPress.com » Removing share & like buttons on specific page templates

  • Resolved John

    (@dsl225)


    Hello,

    I’m using a theme with Custom Post Types for “classes” and “teachers”.
    Both have associated page templates for displaying listing of related posts (listing page of teachers and listing page of classes).

    I enabled Sharing with Like buttons to those CPT and they are correctly showing up in each full page. Problem is those buttons also display in listing pages of those CPTs, even when I don’t enable sharing for pages, and it’s really not nice.

    I use a child theme. Is there a way to prevent those buttons (both Share and Like) to display in those specific listing template pages?

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Stef

    (@erania-pinnera)

    Hey John!

    Can you try adding this following script to see if that works?

    
    if ( is_admin() ){
        function my_remove_meta_boxes() {
            global $typenow;
            if( 'YOUR_CUSTOM_POST_TYPE' == $typenow ) {
                remove_meta_box( 'sharing_meta', 'YOUR_CUSTOM_POST_TYPE', 'advanced' );
            }
        }
        add_action( 'do_meta_boxes', 'my_remove_meta_boxes' );
    }
    

    Remember to replace 'YOUR_CUSTOM_POST_TYPE' with your actual CTP.

    To add this without editing any php files, you can use a plugin like Code Snippets

    Let me know how it goes. Thanks!

    • This reply was modified 7 months, 3 weeks ago by  Stef.

    @erania-pinnera
    Many thanks Stef,

    Unfortunately, it doesn’t seem to work.
    I correctly inserted the right CPT name and added this my child theme functions but no luck.

    Interestingly, I also just found out here that there is an option for “Disabling Likes/Shares for Specific Posts” in page’s edit screen and I also tested unchecking this option there, but still no luck. All sharing buttons are still showing up (but it works fine for normal single posts/pages).

    PS: for what it’s worth, you may find the page template for that CPT listing page here.

    • This reply was modified 7 months, 3 weeks ago by  John.
    Plugin Contributor Stef

    (@erania-pinnera)

    Hello there, I’m sorry it didn’t work out!

    You could try the other option listed here then: https://wordpress.stackexchange.com/questions/124610/remove-show-sharing-buttons-metabox-jetpack-from-custom-post-type, or the update to the accepted answer below that.

    Please note, that it’s not something I’ve tested for before, and that falls a bit out of the scope of our support, so I won’t be able to be much helpful in case it didn’t work as well.

    Let me know how it goes anyways 🙂

    Many thanks Stef,

    I understand but I give up for the time being and will use another plugin for that.

    Plugin Contributor Stef

    (@erania-pinnera)

    I see, but I hope you keep using Jetpack for the other modules!

    Closing the thread for now, but feel free to let us know if there’s anything else you need and we’ll be happy to help 😉

    Sure, no problem!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Removing share & like buttons on specific page templates’ is closed to new replies.