Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #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

    #524166

    See example in private content

    #525355

    Hey!

    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,
    Ismael

    #525854

    Fantastic, thanks Ismael!

    Is it possible to include the year for event dates? (so people know they’re upcoming and not past)

    #526282

    Hey!

    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!
    Yigit

    #530484

    Hello 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

    #534916

    Hey!

    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,
    Elliott

    #535181

    That did it, thanks Elliott!

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Display event date in Enfold search results’ is closed to new replies.