Home › Forums › Calendar Products › Events Calendar PRO › Displaying Event Details in Site Search Results
- This topic has 6 replies, 3 voices, and was last updated 9 years, 10 months ago by
ariddlelfcc.
-
AuthorPosts
-
June 24, 2016 at 9:39 am #1131589
ariddlelfcc
ParticipantHi. I am looking to find out if it is possible to display an event’s details (such as day, time and cost) on a WordPress site’s search listing results.
For example, on our site (http://www.lfccworkforce.com), when you search for “CMA” (one of our event names), the first four occurrences of the event are displayed:
https://lfccworkforce.com/?s=cma
However, one cannot differentiate one from the other as the date and time of the event are not displayed (only the copy talking about the event).
Is it possible to display the event’s time, date and possibly “register now” link in the search results?
Thank you!
Aaron Riddle
——————
Graphic Design and Digital Media Specialist
Lord Fairfax Community College
[email protected]June 26, 2016 at 11:57 am #1132121Nico
MemberHi Aaron,
Thanks for getting in touch with us!
Is it possible to display the event’s time, date and possibly “register now” link in the search results?
Sure this is possible but will require a bit of custom coding, I’ll out line the steps below:
- Find the template that renders search results in your theme (most probably search.php) and locate the part in which the post details are printed. For example: in default theme TwentySixteen the file that renders each post in the search results loop is tweenty-sixteen/template-parts/content-search.php.
- Once you located the file, it’s time to edit it. If you are working with a third-party theme then it’s a good idea to create a Child-Theme for this customization.
- The edit consists in checking if the displayed post is an event, in which case print the event details. Check the code below, it’s based on the default TweentySixteen theme.
> ', esc_url( get_permalink() ) ), ' ' ); ?>
...
Please let me know if you can make it work with your theme,
Best,
NicoJune 27, 2016 at 7:25 am #1132262ariddlelfcc
ParticipantHi! Thanks for the quick reply. I have the date and time of the event showing in the search listings:
https://lfccworkforce.com/?s=cma
However, I still am unable to get the event website link to show. Here is the code I have for that portion. I am unsure what needs to be called to pull the event website link:
<?php // place the custom register URL code below ?> <a href="' . tribe_get_event_website_url() . '">Register now</a> <?php if ( tribe_get_cost() ) : ?> <span class="tribe-events-divider">|</span> <span class="tribe-events-cost"><?php echo tribe_get_cost( null, true ) ?></span> <?php endif; ?>June 27, 2016 at 9:10 am #1132386Nico
MemberThat’s great Aaron!
Printing the URL should be easy:
" >Register now
Please let me know if this gets it right,
Best,
NicoJune 27, 2016 at 2:43 pm #1132619ariddlelfcc
ParticipantPerfect! Thank you so much!
June 28, 2016 at 8:10 am #1132885Nico
MemberYou are welcome Aaron! Stocked to help you out 🙂
I’ll go ahead and close out this thread, but if you need help with anything else please don’t hesitate to create a new one and we will be happy to assist you.
Best,
Nico -
AuthorPosts
- The topic ‘Displaying Event Details in Site Search Results’ is closed to new replies.
