Jetpack plugin (ShareDaddy): Prevent share buttons showing on custom post types?

ShareDaddy uses two filter hooks either the_content or the_excerpt this means that your custom post type theme template file has to use one of these two functions the_content(); or the_excerpt();.

Update

Ok I guess i didn’t get the question. So to add the metabox to your custom post type add this:

// Hook things in, late enough so that add_meta_box() is defined and make sure you already registered you post type.
    if (is_admin()){
        add_action( 'admin_init', 'add_plugin_meta_boxes' );
        add_action( 'save_post', 'save_sharing_box' );
    }

// This function tells WP to add the sharing "meta box"
function add_plugin_meta_boxes() {
    add_meta_box( 'sharing_meta', __( 'Sharing', 'sharedaddy' ), 'sharing_meta_box_content', 'CUSTOM POST TYPE NAME', 'advanced', 'high' );

}

function save_sharing_box( $post_id ) {
    if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
        return $post_id;

    // Record sharing disable
    if ( 'CUSTOM POST TYPE NAME' == $_POST['post_type'] ) {
        if ( current_user_can( 'edit_post', $post_id ) ) {
            if ( isset( $_POST['sharing_status_hidden'] ) ) {
                if ( !isset( $_POST['enable_post_sharing'] ) )
                    update_post_meta( $post_id, 'sharing_disabled', 1 );
                else
                    delete_post_meta( $post_id, 'sharing_disabled' );
            }
        }
    }

  return $post_id;
}

and change CUSTOM POST TYPE NAME to you actual custom post type name.

Leave a Comment