Search by dates

This topic contains 4 replies, has 2 voices, and was last updated by Jaime Fernandez jaimon82 7 years, 11 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #8425
    Jaime Fernandez
    jaimon82
    Participant

    Hi Ernest!
    How you doing today?
    I hope you’re fine.
    🙂

    One question.
    I need to set up searchs for Events dates.
    I’m working with Events Manager and what I need is to show when the Events are going to take place.

    I’ve seeing there’s an option to searchs by dates of publishing, but it’s not what I need.

    How can I manage this search?

    Thanks a lot Ernest

    #8431
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    Thank you very much, I’m doing great, I hope you too!

    I’m guessing you want to display the event date as part of the result description. I’ve put together the following code to display the date before description. Put it into your active theme folder, into the functions.php file:

    add_filter('asp_pagepost_results', 'asp_em_dates', 1, 1); 
    function asp_em_dates( $results ) {
      foreach ($results as $k => $r) {
        if ( $r->post_type != "event" ) continue;
        $event = EM_Events::get($r->id);
        $start = date(get_option( 'date_format' ), $event[0]->start);
        $end =  date(get_option( 'date_format' ), $event[0]->end);
        $results[$k]->content = $start . " - " .$end . "<br>" . $results[$k]->content;
      }
      return $results;
    }  

    Hopefully this will help.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #8435
    Jaime Fernandez
    jaimon82
    Participant

    Hi again Ernest.
    Thanks a lot for the code.
    But actually it’s not what I was looking for.
    So i’ll try to be the more detailed. Sorry if I didn’t explain myself correctly.

    The code you gave me shows the Event date of publication/edition.
    (As far as I saw, it’s showing that.)
    So, if it’s that what you made in the code it’s working OK, but it’s not what I needed.

    I’ll explain myself a litle better.
    I’ve a Events Website.
    So, I need users can search events in relation of when those events are going to take place (not when the events where published)

    I’ve trying every combination that I though it would work, but the search dosen’t work.
    I’ve read the documentation but i didn’t found anything that could help me…
    and I’ve tried to search in your website forums but I couldn’t find nothing relevant either.

    If there’s something that I’m missing (documentation, FAQ’s or forum answers) i’ll be glad to have a look and try to solve it by myself. If not, could you give me any advise or path to reach this search?

    Thanks a lot Ernest.
    You’re great.

    🙂

    #8436
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    I think I get it now. I believe you want to create a date picker filter so the users can select on what range the date is created. Something like: https://i.imgur.com/xyBQbbY.png

    Unfortunately it’s not yet possible with the Events calendar plugin. It’s possible to make date filters with custom fields, but currently it only works with the default Advanced Custom Fields date format, which is not compatible with Events calendar.

    The good news is, that I’m adding a new date filter for the upcoming version with a Video Tutorial on event calendar, which will make this possible. I’m sorry, but there is no temporary solution I can offer until then, it’s a bit more complicated, I hope you understand.

    The new version should be released within a week.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #8437
    Jaime Fernandez
    jaimon82
    Participant

    Ok then Ernest!
    If it will be released within a week I can wait!

    Thanks a lot for your quick answer!
    🙂

    Good weekend!

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Search by dates’ is closed to new replies.