Forums

Subscribe2
Subscribe2 & Custom Post Types (More Types) (8 posts)

  1. husar
    Member
    Posted 10 months ago #

    I am trying to get Subscribe2 to send out updates for my custom post type. I have read the page here...

    http://subscribe2.wordpress.com/2011/02/28/subscribe2-and-custom-post-types/

    The plugin I am using for custom post types is More Types to manage custom post types. My issue is I don't know where to put the recommended code...

    function my_post_types($types) {
    	$types[] = 'my_post_type';
    	return $types;
    }
    
    add_filter('s2_post_types', 'my_post_types');

    to make the custom post types work. Has anyone integrated More Types with the code above?

    Cheers.

  2. MattyRob
    Member
    Posted 10 months ago #

    @husar,

    You need to put this code into a custom plugin for your site or into the functions.php file of your theme.

    I don't use More Types so I don't know anything about it but I guess there must be a way to collect all of the post type slug names and then cycle through them adding them to the $types[] array. Something like:

    $custom_types = $more_types->get_types_function();
    foreach( $custom_type as type ) {
    	$types[] = $type;
    }
  3. MattyRob
    Member
    Posted 10 months ago #

    @husar,

    I had a little time to spare so looked through the More Types code. This is untested but I think it will work.

    global $more_types;
    
    $pages = $more_types->get_objects(array('_plugin_saved', '_plugin'));
    
    foreach((array) $pages as $name => $page) {
    	$types[] = $name;
    }
  4. husar
    Member
    Posted 10 months ago #

    @mattyRob

    What file in the More Types were you looking at. There are size files in that plugin. I have tried a few but not having any luck yet.

  5. husar
    Member
    Posted 10 months ago #

    function my_post_types($types) {
    	$types[] = 'my_post_type';
    	return $types;
    }
    
    add_filter('s2_post_types', 'my_post_types');

    Adding that to my functions.php seems to work now. But that only limits me to one custom post type.

  6. MattyRob
    Member
    Posted 10 months ago #

    @husar,

    Add extra $types[] = ''; lines for each custom type until you have one for each of you custom post types.

  7. jarga
    Member
    Posted 6 months ago #

    Hi

    Please,

    I've added this code to my theme's functions.php file but it doesn't seem to work : no mesages sent and no toggle appears in my custom post detail page in the admin...

    Must I modify that code before inserting it ?

    Thanks

  8. cparodi7
    Member
    Posted 6 months ago #

    Hi, I use GD Taxonomies Tools (http://wordpress.org/extend/plugins/gd-taxonomies-tools/) to register/manage custom posts types and tried the code posted in this thread in functions.php

    function my_post_types($types) {
    	$types[] = 'my_post_type';
    	return $types;
    }
    
    add_filter('s2_post_types', 'my_post_types');

    Unfortunately, it didn't work (I contacted GD's author and he recommended I ask over here).

    Is there possibly a differently way of setting up the functions call so it'll work with GD tools?

Reply

You must log in to post.

About this Plugin

About this Topic