Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

The topic custom post type:

    register_post_type( $this->forum_post_type, $bbp_cpt['forum'] );

    /** TOPICS ************************************************************/

    // Topic labels
    $topic['labels'] = array(
        'name'               => __( 'Topics',                   'bbpress' ),
        'singular_name'      => __( 'Topic',                    'bbpress' ),
        'add_new'            => __( 'New Topic',                'bbpress' ),
        'add_new_item'       => __( 'Create New Topic',         'bbpress' ),
        'edit'               => __( 'Edit',                     'bbpress' ),
        'edit_item'          => __( 'Edit Topic',               'bbpress' ),
        'new_item'           => __( 'New Topic',                'bbpress' ),
        'view'               => __( 'View Topic',               'bbpress' ),
        'view_item'          => __( 'View Topic',               'bbpress' ),
        'search_items'       => __( 'Search Topics',            'bbpress' ),
        'not_found'          => __( 'No topics found',          'bbpress' ),
        'not_found_in_trash' => __( 'No topics found in Trash', 'bbpress' ),
        'parent_item_colon'  => __( 'Forum:',                   'bbpress' )
    );

The tag custom taxonomy:

function register_taxonomies() {

    // Topic tag labels
    $topic_tag['labels'] = array(
        'name'          => __( 'Topic Tags',   'bbpress' ),
        'singular_name' => __( 'Topic Tag',    'bbpress' ),
        'search_items'  => __( 'Search Tags',  'bbpress' ),
        'popular_items' => __( 'Popular Tags', 'bbpress' ),
        'all_items'     => __( 'All Tags',     'bbpress' ),
        'edit_item'     => __( 'Edit Tag',     'bbpress' ),
        'update_item'   => __( 'Update Tag',   'bbpress' ),
        'add_new_item'  => __( 'Add New Tag',  'bbpress' ),
        'new_item_name' => __( 'New Tag Name', 'bbpress' )
    );

    // Topic tag rewrite
    $topic_tag['rewrite'] = array(
        'slug'       => $this->topic_tag_slug,
        'with_front' => false
    );

    // Topic tag filter
    $bbp_tt = apply_filters( 'bbp_register_topic_taxonomy', array(
        'labels'                => $topic_tag['labels'],
        'rewrite'               => $topic_tag['rewrite'],
        'capabilities'          => bbp_get_topic_tag_caps(),
        'update_count_callback' => '_update_post_term_count',
        'query_var'             => true,
        'show_tagcloud'         => true,
        'hierarchical'          => false,
        'public'                => true,
        'show_ui'               => true
    ) );

    // Register the topic tag taxonomy
    register_taxonomy(
        $this->topic_tag_id,    // The topic tag id
        $this->topic_post_type, // The topic post type
        $bbp_tt
    );
}

I would like to list all (or most popular) tags of the custom post type topic. Any suggestions?

share|improve this question
add comment

1 Answer

To grab the bbpress object,:

$bbp = $GLOBALS['bbp'];

followed by:

$topictags = get_terms( $bbp->topic_tag_id, 'orderby=count&hide_empty=0' );
foreach( $topictags as $topictag){
    // do stuff like printing the terms name etc
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.