Support » Plugin: Social » Social for custom posts

Viewing 7 replies - 1 through 7 (of 7 total)
  • use the social_broadcasting_enabled_post_types filter.

    How exactly do we enable this? I’ve found that line in the social.php file but I am not sure how to change it to enable custom post types. Do I just add another array() command to that line?

    Nevermind, figured it out. If anyone else wants to know:

    Go to the plugins page. Click the “Edit” link under Social’s entry. Do a find-in-page search for “social_broadcasting_enabled” which will bring you to this line:

    return apply_filters(‘social_broadcasting_enabled_post_types’, array(‘posts’));

    And then just change “posts” to whatever the name of your custom post types are. I was also able to add multiple post types to that function as well, such as:

    return apply_filters(‘social_broadcasting_enabled_post_types’, array(‘posts’,’news’));

    The only difficulty might be finding out what your custom post types are actually named in the code.

    Thanks, worked like a treat.
    For any one else out there the line of code to change is on line 664.

    Don’t change the code, use the filter. The reason is is there is so you can make changes to functionality without changing the code (and having it break on upgrade, etc.) – just like WordPress core.

    http://codex.wordpress.org/Plugin_API#Filters

    This filter seems to have been updated recently. It now reads:

    public static function broadcasting_enabled_post_types() {
    		return apply_filters('social_broadcasting_enabled_post_types', get_post_types(array(
    			'public' => true,
    			'hierarchical' => false
    		)));
    	}

    This includes my custom post types, but I’m still not getting any comments shown on them. I also tried to just change it to the code listed above without any luck.

    My bad…it turns out I just needed to uncheck and recheck the “Allow people to post comments on new articles” setting to get it rolling for the custom post types.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Social for custom posts’ is closed to new replies.