Jetpack, How to use Publicize with your Custom Post Types

Home Forums Calendar Products Community Events Jetpack, How to use Publicize with your Custom Post Types

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1097516
    Michael
    Participant

    Hello,
    my question:
    can I use this function offers by jetpack?

    How to use Publicize with your Custom Post Types
    By default, Publicize is only triggered when you publish a new post. You can, however, extend this to other Custom Post Types. You have 2 options to add Publicize Support to a Custom Post Type:

    You can add Publicize support to an existing post type thanks to the add_post_type_support() function. To do so, add the following code to a functionality plugin:
    1
    2
    3
    4
    add_action(‘init’, ‘my_custom_init’);
    function my_custom_init() {
    add_post_type_support( ‘product’, ‘publicize’ );
    }
    You’ll need to replace “product” by your Custom Post Type name.

    You can add Publicize support when registering the post type, like so:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    // Register Custom Post Type
    function custom_post_type() {

    $labels = array(
    ‘name’ => _x( ‘Products’, ‘Post Type General Name’, ‘text_domain’ ),
    );
    $args = array(
    ‘label’ => __( ‘product’, ‘text_domain’ ),
    ‘supports’ => array( ‘title’, ‘editor’, ‘publicize’, ‘wpcom-markdown’ ),
    );
    register_post_type( ‘product’, $args );

    }
    // Hook into the ‘init’ action
    add_action( ‘init’, ‘custom_post_type’, 0 );

    If possible where must I insert the code?

    #1098186
    Geoff B.
    Member

    Good evening Michael and welcome back!

    Thank you for reaching out to us.
    I would love to help you with this topic.

    As you can imagine, I cannot possibly guarantee that this will work since, after all, JetPack is a third-party plugin. But it’s worth a try.

    With that in mind, I would stick with the first approach where the piece of code needs to go in the functions.php of your WordPress theme. The custom post type name you are looking for (to replace “product”) is “tribe_events”

    Let me know how that goes.

    Best regards,
    Geoff B.

    #1104376
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Jetpack, How to use Publicize with your Custom Post Types’ is closed to new replies.