Skip to:
Content
Pages
Categories
Search
Top
Bottom

Multiple custom post types in activity stream

  • @4ella

    Participant

    I have posted the comment on support forum yesterday, but I have never see it published maybe because the thread was marked as (resolved) so I will ask again:

    I am succesfuly using @rogercoathup ‘s snippet in bp_custom.php to display custom post type in activity stream, but I would like to use more then ONE CPTs in my activity stream, how can I use it for 2 or more Custom Post Types? When replicating this code it does nothing, does exist some code how to do display multiple Custom Post Types?

    add_filter( ‘bp_blogs_record_post_post_types’, ‘inspired_record_more_types’ );
    
    function inspired_record_more_types( $types ) {
    $types[] = ‘my-cpt-name’;
    
    return $types;
    }
Viewing 9 replies - 1 through 9 (of 9 total)
  • @modemlooper

    Moderator
    function inspired_record_more_types( $types ) {
        $types[] = ‘my-cpt-name-1’;
        $types[] = ‘my-cpt-name-2’;
    
        return $types;
    }
    add_filter( ‘bp_blogs_record_post_post_types’, ‘inspired_record_more_types’ );

    @4ella

    Participant

    Thank you @modemlooper, but this code seems like not working, I have also changed everywhere ‘ to this ‘ 🙁

    @modemlooper

    Moderator

    do you have the option checked in BuddyPress settings to track blog posts?

    @4ella

    Participant

    Yes I do, in settings I have checked: Record activity for new posts and comments from your site, I was succesfully using this snippet for single CPT all the time, but I ve’forgot to say that yesterday I’ve installed latest 1.8 Beta BP version, maybe 1.8 version is different and I have not tried single Custom Post Type activity recording with this version yet, I will try it and report it here.

    @modemlooper

    Moderator

    make sure it’s the plural of the type if thats what you have as the name

    function inspired_record_more_types( $types ) {
    
        $types[] = 'customs';
        $types[] = 'roles';
    
        return $types;
    }
    
    add_filter( 'bp_blogs_record_post_post_types', 'inspired_record_more_types', 1, 1);

    @4ella

    Participant

    @modemlooper Thanks again for your respond, but I can’t get it work, pls. take a look at my custom-type.php on pastebin where I have 4 custom post types registered:
    http://pastebin.com/PuQczr0A
    maybe I should also register plural name to make it work ?

    and pls.take a look at your code in my bp-custom.php:
    http://pastebin.com/B9xUuMN8

    I’ve tried many variations as singular and plural and
    with ‘inspired_record_more_types’, 1, 1);
    without ‘inspired_record_more_types’);

    I’ve created 23 new posts of CPT “applicant” and no record on activity stream, I ve’seen here:
    https://buddypress.trac.wordpress.org/ticket/3460
    that @boonebgorges is trying to implement Custom Post Types in activity stream in future versions in buddypress I can’t wait for that.

    @modemlooper

    Moderator

    Hmm, maybe a lowercase issue.

    Try portfolios instead of Portfolios. The name and singular name should be lower case. The other array items can be upper since they are what is displayed but the first two are the slugs.

    @4ella

    Participant

    Thank you, I will change it immediately and will try that and report it here.

    @4ella

    Participant

    @modemlooper I very apologize for my mistake, yesterday all the day I have been wrongly adding the bp-custom.php into bp-default folder instead of plugin directory, that’s why it was always the same, NOT working 🙁 your first code was correct, it is working good, plural names code didn’t work for me.

    function inspired_record_more_types( $types ) {
    
        $types[] = 'portfolio';
        $types[] = 'applicant';
    
        return $types;
    }
    
    add_filter( 'bp_blogs_record_post_post_types', 'inspired_record_more_types');
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Multiple custom post types in activity stream’ is closed to new replies.
Skip to toolbar