Skip to:
Content
Pages
Categories
Search
Top
Bottom

Custom Views with AND and OR statements


  • iftomkins
    Participant

    @iftomkins

    I’ve been using the bbPress Custom Views plugin (http://wordpress.org/extend/plugins/bbp-views/). I’ve been creating custom views, but I’m wondering how to create a custom view which is an AND or OR statement, so meets 2 different conditions. Here’s an example (though written incorrectly of course).

    bbp_register_view( 'rides-needed', __( 'Rides Needed' ), array( 'meta_key' => 'needed_offered', 'meta_value' => 'Need a Ride' AND/OR 'meta_key' => 'ride-destination', 'meta_value' => 'Timberline'), false );

    So, that is to say: display the topics WHERE:

    meta_key “needed_offered” = ‘Need a Ride’

    AND

    meta_key “ride-destination” = ‘Timberline’.

    From Gautam’s post (http://bbpep.com/2011/04/creating-custom-views-in-bbpress/) I know I can use these parameters (http://codex.wordpress.org/Function_Reference/WP_Query#Parameters), but I’m not sure how to translate WPQuery into the register views function. Thanks in advance!

  • You must be logged in to reply to this topic.
Skip to toolbar