Displaying Event Details in Site Search Results

Home Forums Calendar Products Events Calendar PRO Displaying Event Details in Site Search Results

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1131589
    ariddlelfcc
    Participant

    Hi. 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]

    #1132121
    Nico
    Member

    Hi 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.

    Please let me know if you can make it work with your theme,
    Best,
    Nico

    #1132262
    ariddlelfcc
    Participant

    Hi! 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; ?>
    #1132386
    Nico
    Member

    That’s great Aaron!

    Printing the URL should be easy:


    " >Register now

    Please let me know if this gets it right,
    Best,
    Nico

    #1132619
    ariddlelfcc
    Participant

    Perfect! Thank you so much!

    #1132885
    Nico
    Member

    You 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

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Displaying Event Details in Site Search Results’ is closed to new replies.