• Resolved bunjip

    (@bunjip)


    Hi,

    I follow this post to add a ‘venue city’ filter to the events bar of The Events Calendar.

    However, the docs end at the interesting part. It says

    add_filter( 'tribe_events_pre_get_posts', 'setup_my_bar_field_in_query', 10, 1 );
    function setup_my_bar_field_in_query( $query ){
    if ( !empty( $_REQUEST['tribe-bar-my-field'] ) ) {
    // do stuff
    }
    return $query;
    }

    Well, I’m looking for the // do stuff part to enable users to filter events by venue’s cities. What would the appropriate $args array need to look like that needs to be added to the WP_QUERY object via ‘tribe_events_pre_get_posts’ filter?

    • This topic was modified 7 years, 11 months ago by bunjip.
    • This topic was modified 7 years, 11 months ago by bunjip.
    • This topic was modified 7 years, 11 months ago by bunjip.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Hey @bunjip,

    Thanks for using The Events Calendar, I’m happy to help you out with this! ??

    Sounds like you’re trying to make some pretty cool changes! ?? I want to make sure I’m understanding exactly what you’re trying to do, could you possibly send me some screenshots denoting the changes you want to make and a link to your site? This will help me give you better guidance in this matter if I understand the application of your request more directly (plus I’m a visual person).

    In the meantime, I think you may find our Themer’s Guide and our Functions List helpful for the types of changes you’re trying to make. ?? Once I hear back from you, hopefully I can give you more specific resources.

    Cheers!

    Shelby ??

    Thread Starter bunjip

    (@bunjip)

    Hey @shelbelliott,

    Thanks for your reply! I’ll try my best to illustrate my intention ??

    Image #1 – Admin backend: Event location to choose for a given event

    Image #2 – Frontend view with default filters:

    Image #3 – Frontend view with custom ‘City’ filter:

    Can’t send you a link to my site, though. I’m developing on my local machine. So, basically, I want to display advanced filter options for events based on the event location. In this case, the ‘city’ field from the location post type should be the filter option.

    Can you imagine what I’m after :)?

    Thanx,
    Bunjip

    p.s. Uhm… can’t see the images which I included in my reply here. So I added links to the images in a paste bin

    • This reply was modified 7 years, 11 months ago by bunjip.
    • This reply was modified 7 years, 11 months ago by bunjip.
    • This reply was modified 7 years, 11 months ago by bunjip.

    Hey @bunjip,

    I see what you’re trying to do, and there’s good news!

    I think you’ll find that our Filter Bar plugin does exactly what you need. ?? You can check it out here.

    Let us know if you have any other questions or issues!

    Best,

    Shelby ??

    Hey there! This thread has been inactive for a while so we’re going to go ahead and mark it Resolved. Please feel free to open a new thread if any other questions come up and we’d be happy to help. ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WP_Query to filter events by venue city’ is closed to new replies.