Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I noticed ShareDaddy has "Show sharing buttons on this post" for default post types but not for custom post types. I'm guessing I need to add something in 'supports' => array('title','editor','thumbnail'). Does anybody know what I need to add in order for "Show sharing buttons on this post" to show up for custom post types?

share|improve this question
add comment

3 Answers

up vote 2 down vote accepted

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.

share|improve this answer
    
I'm not sure if I've misunderstood your answer or if I wasn't clear enough in my question. Basically, I want the metabox for "Show sharing buttons on this post" for each post in my custom post type to show. I assume I can control this by adding an item to the supports array. –  jwp Mar 28 '11 at 22:49
    
@jwp: sorry i didn't get the question. I updated my answer. –  Bainternet Mar 28 '11 at 23:56
add comment

I know this is an older post, but I found this site when searching for an answer, then found the real answer somewhere else, so I thought i would share it for anyone else having a similar issue.

I created 2 Custom Post-Types and wanted the Share buttons in Jetpack to show up.

I thought it would probably be a code in the functions.php file, as that's where I got the rest of the functionality for the Custom Post-Types.

In fact, I simply went to the Settings->Sharing menu. The Custom Post-Types were there in the list and all I needed to do was put a check in each box to make it work like I wanted.

No extra coding, just a simple check mark.

share|improve this answer
add comment

Solution is editing jetpack/modules/publicize/publicize.php

line 354 change by this

function post_type_is_publicizeable( $post_type ) {
    if ( 'Your_custom_post' == $post_type )
        return true;
    if ( 'post' == $post_type )
        return true;

    return post_type_supports( $post_type, 'publicize' );
}
share|improve this answer
    
The solution is never editing the plugin directly. Any changes you make will be lost in future plugin versions. Jetpack provides some developer tools, including some filters that may provide a much better option that editing and re-editing the plugin itself. –  Dan Mar 25 at 18:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.