Skip to:
Content
Pages
Categories
Search
Top
Bottom

filter topics by post_meta value

Viewing 2 replies - 1 through 2 (of 2 total)
  • @shanebp

    Participant

    It seems that content-single-forum.php is the template to over-ride.

    So do I have to pass in WP_Query meta_query args to bbp_has_topics() ?

    I’d like to only gather the appropriate topics, so using the supplied apply_filters
    apply_filters( 'bbp_has_topics', $bbp->topic_query->have_posts(), $bbp->topic_query );
    seems inefficient.

    Or is there an easier way?

    @shanebp

    Participant

    This seems to work – there may be a better way…

    In an over-ride of content-single-forum.php, do something like this:

    if ( // some condition ) {
     
    	$my_r['meta_query'] = array(
    		array(
    		'key' => 'my_key',
    		'value' => 'my_value',
    		'compare' => '=',
    		)
    	);
    }
    else
    	$my_r = ''; 

    Then change bbp_has_topics() to bbp_has_topics( $my_r )

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