Home › Forums › Calendar Products › Events Calendar PRO › Include event date/ time in default WordPress search results
- This topic has 8 replies, 2 voices, and was last updated 8 years, 4 months ago by
Technology Team.
-
AuthorPosts
-
November 19, 2017 at 10:18 pm #1386889
Technology Team
ParticipantWhen 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.
November 21, 2017 at 9:58 am #1388290Victor
MemberHi 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,
VictorNovember 25, 2017 at 1:45 pm #1391716Technology Team
ParticipantHi, 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.
November 25, 2017 at 1:48 pm #1391717Technology Team
ParticipantI’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.
November 27, 2017 at 7:10 am #1392392Victor
MemberHi 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,
VictorDecember 4, 2017 at 11:00 am #1397999Technology Team
ParticipantThis reply is private.
December 5, 2017 at 7:27 am #1398578Victor
MemberSure 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!
VictorDecember 27, 2017 at 8:35 am #1413315Support Droid
KeymasterHey 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 -
AuthorPosts
- The topic ‘Include event date/ time in default WordPress search results’ is closed to new replies.
