How to create a custom nested loop in bbPress (WordPress + bbPress plugin)

bbpress has its own query class called BB_Query()

and it accepts:

    $ints = array(
            'page',     // Defaults to global or number in URI
            'per_page', // Defaults to page_topics
            'tag_id',   // one tag ID
            'favorites' // one user ID
        );

    $parse_ints = array(
        // Both
        'post_id',
        'topic_id',
        'forum_id',

        // Topics
        'topic_author_id',
        'post_count',
        'tag_count',

        // Posts
        'post_author_id',
        'position'
    );

    $dates = array(
        'started',  // topic
        'updated',  // topic
        'posted'    // post
    );

    $others = array(
        // Both
        'topic',    // one topic name
        'forum',    // one forum name
        'tag',      // one tag name

        // Topics
        'topic_author', // one username
        'topic_status', // *normal, deleted, all, parse_int ( and - )
        'open',         // *all, yes = open, no = closed, parse_int ( and - )
        'sticky',       // *all, no = normal, forum, super = front, parse_int ( and - )
        'meta_key',     // one meta_key ( and - )
        'meta_value',   // range
        'topic_title',  // LIKE search.  Understands "doublequoted strings"
        'search',       // generic search: topic_title OR post_text
                        // Can ONLY be used in a topic query
                        // Returns additional search_score and (concatenated) post_text columns

        // Posts
        'post_author',  // one username
        'post_status',  // *noraml, deleted, all, parse_int ( and - )
        'post_text',    // FULLTEXT search
                        // Returns additional search_score column (and (concatenated) post_text column if topic query)
        'poster_ip',    // one IPv4 address

        // SQL
        'index_hint',   // A full index hint using valid index hint syntax, can be multiple hints an array
        'order_by',     // fieldname
        'order',        // *DESC, ASC
        'count',        // *false = none, true = COUNT(*), found_rows = FOUND_ROWS()
        '_join_type',   // not implemented: For benchmarking only.  Will disappear. join (1 query), in (2 queries)



// Utility
//          'append_meta',  // *true, false: topics only
//          'cache_users',  // *true, false
//          'cache_topics,  // *true, false: posts only
//          'post_id_only', // true, *false: this query is only returning post IDs
            'cache_posts'    // not implemented: none, first, last
        );

Leave a Comment