Tagged: event date, events calendar PRO, search results
-
AuthorPosts
-
October 24, 2015 at 1:24 am #524165
Hello,
We use the Events Calendar Pro plugin by Modern Tribe. When using the built-in Enfold search, we really like how event posts pop up in the preview as you type. But on the search results page, the post date is displayed beside each event. Is there a way to instead show the event date? The post date is misleading to viewers.
Thanks
October 24, 2015 at 1:29 am #524166See example in private content
October 27, 2015 at 8:37 am #525355Hey!
Thank you for using Enfold.
Please edit includes > loop-search.php, look for this code around line 40:
<?php the_time('d M Y'); ?>
.. replace it with:
<?php if(get_post_type($the_id) == "tribe_events") { the_event_start_date($the_id); } else { the_time('d M Y'); } ?>
Best regards,
IsmaelOctober 28, 2015 at 12:32 am #525854Fantastic, thanks Ismael!
Is it possible to include the year for event dates? (so people know they’re upcoming and not past)
October 28, 2015 at 4:54 pm #526282Hey!
Please go to Enfold/includes folder and open loop-search.php file and find
<?php the_time('d M Y'); ?>
and change it to
<?php the_time('F j, Y'); ?> @ <?php the_time('g:i a'); ?>
Cheers!
YigitNovember 5, 2015 at 3:05 am #530484Hello Yigit,
I had previously replaced:<?php the_time(‘d M Y’); ?>
with…
<?php
if(get_post_type($the_id) == “tribe_events”) {
the_event_start_date($the_id);
} else {
the_time(‘d M Y’);
}
?>… in enfold child theme > includes > loop-search.php file, which displayed the event date instead of post date, but was missing the year. I then replaced this new new code:
<?php
if(get_post_type($the_id) == “tribe_events”) {
the_event_start_date($the_id);
} else {
the_time(‘d M Y’);
}
?>
with …<?php the_time(‘F j, Y’); ?> @ <?php the_time(‘g:i a’); ?>
Now in search results we get the post date with year, rather than the event date with year. I’ve obviously replaced the wrong part, can you give a little more direction?
Thanks
November 12, 2015 at 5:26 pm #534916Hey!
It looks like that one is deprecated. Try this one out, https://theeventscalendar.com/function/tribe_get_start_date/.
echo tribe_get_start_date($the_ID, false, 'd M Y');
Best regards,
ElliottNovember 13, 2015 at 1:47 am #535181That did it, thanks Elliott!
-
AuthorPosts
- The topic ‘Display event date in Enfold search results’ is closed to new replies.