Filter by Category and Tag

Home Forums Calendar Products Events Calendar PRO Filter by Category and Tag

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1154765
    Evy
    Participant

    I am trying to create a list of events that are in a category AND have a certain tag. So for instance I want a list of events that are in the category Crieve Hall and have the tag women. Ideally I want to display a list of those events. Is this possible? If it isn’t then what is a workaround so I can achieve this goal.

    #1155083
    Nico
    Member

    Hi Evy,

    Thanks for reaching out to us on this!

    Not sure if you are referring to achieving this with the Filter Bar plugin (to change the ‘OR’ logic for ‘AND’ logic) or if you want to get this event list in a page or other place as a separate.

    If it’s the Filter Bar one, let me know and I can look into crafting a snippet to achieve this. On the other and if this is just a list of events you want to embed somewhere, you can use the PRO shortcodes for advanced list widget which accept category and tags parameters.

    Please let me know about it,
    Best,
    Nico

    #1155293
    Evy
    Participant

    Nico,

    Thanks for your response. I am trying to achieve a list of event on a page and am using the PRO shortcodes. My problem is that I am trying to include only those events who are in a certain category AND have a certain tag. Right now when I use [tribe_events_list category=”crieve-hall” tag=”women” limit=”10″] it seems to work like an OR instead of an AND. You can see that here…http://midtownfel.staging.wpengine.com/crieve-hall/crieve-hall-women/. I want this list to be events that are in the category “Crieve Hall” and tagged with “women”.

    Thoughts?

    #1155847
    Nico
    Member

    I get you now Evy, thanks for clarifying ๐Ÿ™‚

    Try adding this snippet to your theme’s (or child theme’s) functions.php file:

    /* Tribe, change tax query relation to AND instead of OR */
    function tribe_list_widget_tax_query_relation ( $args ) {

    // bail if no relation is no tax query
    if ( !isset( $args['tax_query'] ) ) return $args;

    $args['tax_query']['relation'] = 'AND';

    return $args;
    }
    add_filter ( 'tribe_events_list_widget_query_args', 'tribe_list_widget_tax_query_relation', 100 );

    Please let me know if this works for you,
    Best,
    Nico

    #1156286
    Evy
    Participant

    Nico,

    This is perfect. Thank you for your help.

    #1156362
    Nico
    Member

    Stocked to hear this worked for you Evy ๐Ÿ™‚

    Iโ€™ll go ahead and close out this thread, but if you need help with anything else please donโ€™t hesitate to create a new one and we will be happy to assist you.

    Have a great weekend,
    Nico

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Filter by Category and Tag’ is closed to new replies.