Skip to:
Content
Pages
Categories
Search
Top
Bottom

Creating a bbPress Shortcode to Display Filtered Topics

  • @iftomkins

    Participant

    Hi. I’m trying to create a bbPress shortcode so that I can display topics that have a certain meta_key value. I’ve been trying to piece it together from the global bbpress shortcodes and wordpress shortcode tutorials.

    I’m using a Dev4Press premium plugin to create the custom fields for each bbpress topic. (http://www.dev4press.com/download/plugin-gd-taxonomies-tools) Now I just have to figure out how to filter based on the custom data.

    Here’s what I have. It isn’t going so well, and I’d love a tip.

    <?php function FilterTopics($topics_query = array()) {
    'meta_key' => 'ride_destination',
    'post_type' => 'topic',
    'posts_per_page' => -1
    );
    }

    if ( bbp_has_topics( $topics_query ) ) {
    bbp_get_template_part( 'bbpress/pagination', 'topics' );
    bbp_get_template_part( 'bbpress/loop', 'topics' );
    bbp_get_template_part( 'bbpress/pagination', 'topics' );

    // No topics
    } else {
    bbp_get_template_part( 'bbpress/feedback', 'no-topics' );
    }

    add_shortcode('sitemap', 'GenerateSitemap'); ?>

Viewing 1 replies (of 1 total)
  • @iftomkins

    Participant

    Ok! Gave up on the shortcode and found a better solution using the bbPviews plugin, in tandem with the GD Custom Posts and Taxonomies Plugin I bought which creates the bbPress custom fields. Here’s a tutorial I made on filtering by bbpress custom views on my website!

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar