Skip to:
Content
Pages
Categories
Search
Top
Bottom

Can't get CPT front end activity filter to show CPT in BP 2.2

  • @rossagrant

    Participant

    Hey guys,

    So after the new activity CPT feature in BP 2.2, I have registered a CPT I have on my site that deals with a site notice board.

    Using the example that is given in the codex, my code looks like this:

    /**
    	 * Register any post types
    	 *
    	 * @since 	Notice Board (1.0)
    	 * @access	public
    	 */
    	public function register_post_types() {
    		register_post_type(	$this->post_type, array(
    			'labels'              => array(
    				'name'               => __( 'Notices',                   'nb' ),
    				'menu_name'          => __( 'Notices',                   'nb' ),
    				'singular_name'      => __( 'Notice',                    'nb' ),
    				'all_items'          => __( 'All Notices',               'nb' ),
    				'add_new'            => __( 'New Notice',                'nb' ),
    				'add_new_item'       => __( 'Create New Notice',         'nb' ),
    				'edit'               => __( 'Edit',                      'nb' ),
    				'edit_item'          => __( 'Edit Notice',               'nb' ),
    				'new_item'           => __( 'New Notice',                'nb' ),
    				'view'               => __( 'View Notice',               'nb' ),
    				'view_item'          => __( 'View Notice',               'nb' ),
    				'search_items'       => __( 'Search Notices',            'nb' ),
    				'not_found'          => __( 'No notices found',          'nb' ),
    				'not_found_in_trash' => __( 'No notices found in Trash', 'nb' ),
    				'parent_item_colon'  => __( 'Notice:',                   'nb' ),
    				'bp_activity_admin_filter' => __('New Notice Published', 'nb'),
    				'bp_activity_front_filter' => __('Notices', 'nb'),
    				'bp_activity_new_post' => __('%1$s posted a new <a href="%2$s">notice</a>', 'nb'),
    				'bp_activity_new_post_ms' => __('%1$s posted a new <a href="%2$s">notice</a>', 'nb')

    EVERYTHING works fine EXCEPT the CPT DOES NOT show in the front-end activity filter.

    The backend filter in the activity dashboard is there and so are the activity items, referencing the CPT posts.

    There is just no front-end filter listed for ‘Notices’.

    Any ideas what i could be doing wrong?

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • @youmin

    Participant

    Hi ,, I too don’t no the exact code but this will help you correct what went wrong,
    You need to tweak it to work with notices.

    Custom Post Type Support for Activity

    Hope this will help you a bit, and don’t forget to publish your corrected codes .

    @imath

    Moderator

    Hi i only see labels argument of your custom post type in your description how do you actually add the ‘buddpress-activity’ support and do you use a bp_activity argument where you define the contexts for the front end dropdown filters.

    Post Types Activities

    @imath

    Moderator

    If you define a contexts argument in the bp_activity post type parameter, it allows you to controle the front dropdown filters where the option will be output : see https://codex.buddypress.org/developer/function-examples/bp_activity_set_action/ for a full explanation.

    If this is still not working, i can see 2 explanations :
    1/ The active theme is a standalone BuddyPress theme or a theme that overrides some templates without being ready for the way of fetching activity filters introduced in BuddyPress 2.1 see : https://codex.buddypress.org/themes/activity-dropdown-filters-in-templates/
    2/ Or the post type is registered within a subsite scope and not registered network widely.

    @rossagrant

    Participant

    @imath you got it in one.

    My theme just needed a template update to fetch the filters after BP 2.1.

    All works great now, so thanks so much for your input – really appreciate it!

    @imath

    Moderator

    @rossagrant you’re very welcome 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Can't get CPT front end activity filter to show CPT in BP 2.2’ is closed to new replies.
Skip to toolbar