Show calendar search results as list view by default

Home Forums Calendar Products Events Calendar PRO Show calendar search results as list view by default

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #1121003
    Pieter Heineken
    Participant

    Hi there. Great plugin and thanks in advance for your support.

    I’m looking to show all results (multiple months) when a search is a performed. From what I understand this isn’t possible under month view so as an alternate solution I’d like to show all search results as list view by default so it shows every result without having to go to the next month. Is this possible?

    Also in a related question I’m also trying to show all results with any of the words used in the search query. So if the search query is “wordpress event” it would show all results containing the words “wordpress” or “event”, as opposed to what it does now which is look for an exact match for “wordpress event”. How can I change this?

    Thanks,

    Pieter

    #1121012
    Pieter Heineken
    Participant

    Forum won’t allow me to create another topic, it marked my topic as spam when I tried to edit and now I can’t repost it without getting a duplicate error. So here is an additional support topic below. Thanks again.

    —————–

    Hi there,

    I have the mini calendar widget currently set to 10 results
    [tribe_mini_calendar count=”10″]. This is fine when a specific date is selected, depending on the number of events for that date the mini calendar only populates that many, up to a maximum of 10. However when the mini calendar initially loads it shows the remaining months events which takes up the full 10 slots unless it is the last day or so of the month. Is there a way to limit the number of results for the initially loading of the mini calendar or perhaps only show todays events as opposed to showing the entire months results (10 maximum results).

    Thanks,

    Pieter

    #1121300
    Josh
    Participant

    Hey Pieter,

    Thanks for reaching out to us!

    It looks like your second request went through to our forums so I’ll let that one be handled separately and address the first issue here.

    For the first, we can try adding the query arg for showing the list view by using the filter on the results there.

    Try using:

    
    
    add_filter( 'tribe_events_get_current_filter_url', 'search_to_list_view' );
    function search_to_list_view() {
    
    global $wp;
    
    $url = esc_url( add_query_arg( array( $wp->query_string => '', 'eventDisplay' => 'list' ), home_url( $wp->request ) ) );
    
    return $url;
    }
    

    To modify the search behavior, it may be best to look for a third-party plugin that will modify the default search capabilities of WordPress. Something like https://wordpress.org/plugins/wp-extended-search/ or SearchWP may be helpful here.

    Let me know if this helps.

    Thanks!

    #1126249
    Pieter Heineken
    Participant

    Hi Josh,

    Thanks for your reply. I tried that code in functions.php but searches are still showing calendar view by default. Also I tried installing Relevanssi to modify the WordPress search functionality, which it does, but it doesn’t seem to work for the tribe bar search. Help?

    Thanks,

    Pieter

    #1127113
    Josh
    Participant

    Hey Pieter,

    I’m having some inconsistent behavior with that snippet as well now. You may need to pursue a javascript approach that runs after the AJAX action is completed. I’ll reach out to one of our developers to see if they have any feedback or direction on this particular one.

    Thanks!

    #1127119
    Pieter Heineken
    Participant

    Thank you Josh I appreciate your help.

    – Pieter

    #1128469
    Josh
    Participant

    Hey Pieter,

    Just wanted to follow up with you here. Still working with our team to get something to help get you pointed in the right direction before the weekend.

    Thanks!

    #1129434
    Pieter Heineken
    Participant

    Hi Josh,

    Any further thoughts on this?

    Thanks,

    Pieter

    #1129601
    Josh
    Participant

    Hey Pieter,

    Sorry for the delay on this one.

    Try adding the following snippet to your theme’s function.php file:

    https://gist.github.com/BeardedGinger/02054580247c76a7bbce3acac06834e5

    And let me know if this helps. I’ve tested on my local install and it appears to be working as expected when searching.

    Thanks!

    #1129832
    Pieter Heineken
    Participant

    Thank you Josh – that works perfectly!

    As to the second point, any idea whats going on with the calendar search? I added Relevanssi which successfully modifies the default WordPress search behavior but it doesn’t seem to have any effect on the calendar search. Do you know why that is?

    Thanks,

    Pieter

    #1130329
    Josh
    Participant

    Hey Pieter,

    Awesome! I’m glad that helped!

    I am limited in the customization support that I provide for the search here though. By default, our search uses the default “s” argument for the query. Doing a little research here, it looks like you could play around with the “sentence” argument. You could extend the event search query by using the “tribe_events_pre_get_posts” action and passing additional query variables there if the search is set.

    Thanks!

    #1130357
    Pieter Heineken
    Participant

    Hi Josh. Thanks for the reply.

    So I take it that the tribe search can’t be extended by using a third-party search plugin as you said previously right? I don’t know that what I’m asking is all that complicated but unfortunately I wouldn’t know where to even start with this one. What I want is for the keywords to be searched individually rather than together, so if I searched for the term “apple banana” all the events mentioning “apple” and “banana” would show up, not “apple banana” as is currently the case. If you can provide any further insight on this I’d greatly appreciate it.

    Thanks,

    Pieter

    #1130861
    Josh
    Participant

    Hey Pieter,

    It should, only if the plugin is modifying the “s” argument for the WordPress WP_Query. However, there could be some issue with the way some plugins apply it.

    Here is a quick example of a modification that may help here

    
    
    function any_word_search_posts_search_filter($search, &$query) {
    
    $search = preg_replace( '#\)[[:space:]]+AND[[:space:]]+\(#', ') OR (', $search );
    return $search;
    }
    add_filter('posts_search', 'any_word_search_posts_search_filter', 10, 2);
    

    Can’t guarantee that would be a 100% solution for your site but would be a good starting point for you in modifying the search to do what you’re looking for.

    Thanks!

    #1130960
    Pieter Heineken
    Participant

    Thank you Josh – this is super helpful.

    You’ve gone above and beyond, I’m very grateful for your help.

    – Pieter

    #1131446
    Josh
    Participant

    Hey Pieter,

    No problem! Happy to help.

    I’ll go ahead and close this thread for now. If you have any further questions, please don’t hesitate to open a new one.

    Thanks!

Viewing 15 posts - 1 through 15 (of 15 total)
  • The topic ‘Show calendar search results as list view by default’ is closed to new replies.