Skip to:

Custom Query Loop

  • brettlewis


    I’m creating a custom topic query for a section of my website that hooks into the default loop template. In the template I use
    <?php if ( bbp_has_topics(array( 'posts_per_page' => 7, 'max_num_pages' => 1, 'bbp_voice_count' => 'DESC', order => 'DESC' )) ) : ?>

    What I’m trying to achieve is a query the shows 7 topics that have the most participants over the last few days. I went with order as the time query but clearly making sure it only shows topics that have BOTH a large amount of users AND are currently active is what I’m trying to achieve.

    Any hints or different args to use to achieve this?

    sidenote: I doesn’t seem bbp_voice_count works?

Viewing 2 replies - 1 through 2 (of 2 total)

  • brettlewis


    Here is a start to the code. I got some help on a differnt forum:

    <?php if ( bbp_has_topics(array( 'posts_per_page' => 3, 'max_num_pages' => 1, 'order' => 'DESC','meta_key' => '_bbp_voice_count', 'orderby' => 'meta_value_num' )) ) : ?>

    How would I add time as “since x number of days” to this query. I only want it showing the most popular voice count that are fresh within the last week or so. Any clues?

    Robin W


    check out this reference (bbp_has_topics passes the info to wp_query)

    about two thirds of the way down (and it’s a long way down!) you’ll find date parameters and examples

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