Custompress and Jetpack Publicize

Jetpack Publicize now supports custom post types, as seen here: http://jetpack.me/2014/01/31/jetpack-2-8-introducing-markdown-and-improving-monitor/

however, custompress in it's design and all, does not use the same stuff as a manually made custom post type. With this new information, what can we do to make Custompress post types, bring the Publicize funtion, into play? Seems like we just need to find the equivalent control spot for functions and add the

'supports' => array( 'title', 'editor', 'publicize', 'wpcom-markdown' ),

Let me know if someone can pinpoint this and see if we can't get a great addition to Custompress working!

  • Michael Bissett

    Hey @AIPman1, hope you're doing well today! :slight_smile:

    In this case, the add_post_type_support function would need to be employed here:

    https://codex.wordpress.org/Function_Reference/add_post_type_support

    Using something like this:

    <?php
    add_action('init', 'add_publicize_support_to_example_cpt');
    function add_publicize_support_to_example_cpt() {
    	add_post_type_support( 'example_cpt', 'publicize' );
    }
    ?>

    Having the ability to handle custom post type features inside of CustomPress would definitely be handy though! I've this moved over to the Features & Feedback section on the forums, so that this can be voted on by the members here in the community for consideration in a future release. :slight_smile:

    Kind Regards,
    Michael

  • AIPman1

    Unfortunately, I would have no idea where to add that - I'm no coder...just an idea guy, lol. The way I read that - it was just a matter of adding - 'publicize', - in a line that already existed...but that was for manually created custom post types. If someone can tell me where to add what specific code I'll be happy to test it, I mean I can find the post.php file just fine...but where in that file to add this? Also, that's a core file right? It'd be overwritten in upgrades? I generally don't employ custom code outside a template file in a child theme, etc. - but if it helps us get to being able to use Publicize in Custompress Post Types, that's important right?

  • AIPman1

    OK, so - specific directions for those that need them:

    1.) I created a file in my MU-Plugins folder called it /jetpack-post-type.php

    2.) I put in the following code, to cover all of my post types:

    <?php
    add_action('init', 'add_publicize_support_to_page');
    function add_publicize_support_to_page() {
    	add_post_type_support( 'page', 'publicize' );
    }
    add_action('init', 'add_publicize_support_to_creator');
    function add_publicize_support_to_creator() {
    	add_post_type_support( 'creators', 'publicize' );
    }
    add_action('init', 'add_publicize_support_to_product');
    function add_publicize_support_to_product() {
    	add_post_type_support( 'product', 'publicize' );
    }
    add_action('init', 'add_publicize_support_to_funder');
    function add_publicize_support_to_funder() {
    	add_post_type_support( 'funder', 'publicize' );
    }
    add_action('init', 'add_publicize_support_to_incsub_event');
    function add_publicize_support_to_incsub_event() {
    	add_post_type_support( 'incsub_event', 'publicize' );
    }
    ?>

    3.) Tested...it adds the publicize functionality to all posts types i added it to including pages, and better than that, it successfully posted the test post to facebook, twitter, Google, etc, just like it should. So now, anyone can add publicize support to any post type...just add a section to your file with the additional post type

    4.) I can also report that it works across a network, so all sites in a multisite will be able to use it.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.