Include event date/ time in default WordPress search results

Home Forums Calendar Products Events Calendar PRO Include event date/ time in default WordPress search results

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1386889
    Technology Team
    Participant

    When someone uses our default search form for our site, Event Calendar and non-Event Calendar listings populate the results. I’d like to have the Event Calendar results show their event dates in those results. Our search.php file is pretty standard and I’m at a loss as to where to make sure the date/time of the event shows up. If you could point me to the right files if they reside in the Events Calendar folders rather than the search.php or the content.php files or point me in the direction I need to head I’d really appreciate it.

    #1388290
    Victor
    Member

    Hi There!

    Thanks for reaching out to us. Let me try to help you with this topic.

    If you want to add the event dates to the default WordPress search, you would have to customize the search.php template file from your theme.

    You can learn more about the search.php template here > https://codex.wordpress.org/Creating_a_Search_Page

    I know some users prefer to not show events in their default WordPress search results, in which case you can use the following snippet:

    https://gist.github.com/ckpicker/5013681

    I hope that helps. Let me know if you have any follow up questions.

    Best,
    Victor

     

    #1391716
    Technology Team
    Participant

    Hi, thanks. You didn’t include a snippet that I can see.

    Concerning the search.php file, that’s what I’m customizing but I’m not sure which portion of the events calendar hook I need to call. Can you help me identify that? Or the file I need to look at in the Events Calendar to pull from? Thanks.

    #1391717
    Technology Team
    Participant

    I’m trying to display/ customize the events calendar display when it appears in the search. I’m just looking for pointers on what Event Calendar files to look at for any specific hooks I need to use.

    #1392392
    Victor
    Member

    Hi There!

    I’m sorry about the snippet, I pasted a broken URL and did not embed the gist inside the post. I’ve just edited the gist URL so it should show up correctly.

    Customizing the search.php template file would to add the event start date would depend on the theme you are using. I’d recommend you add a conditional inside the search.php loop to check for the tribe_events post type and output the event start date by using the tribe_get_start_date() helper function.

    Here’s an example of what you can add:

    if ( 'tribe_events' === get_post_type() ) { echo tribe_get_start_date(); }

    I’m trying to display/ customize the events calendar display when it appears in the search

    I’m not sure I understand exactly what you want to accomplish here. Are you trying to customize our calendar views? If so, you should check out our themer’s guide > https://theeventscalendar.com/knowledgebase/themers-guide/

    I hope it helps. Let me know if you have any follow up questions.

    Best,
    Victor

    #1397999
    Technology Team
    Participant

    This reply is private.

    #1398578
    Victor
    Member

    Sure thing! Thanks for following up with this.

    I’ll leave the thread open so you can follow up with any questions. Do note that after a couple of weeks it will auto-close, in which case you can always open a new topic referencing this one.

    Good luck!
    Victor

    #1413315
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Include event date/ time in default WordPress search results’ is closed to new replies.