• Resolved Webreaper

    (@webreaper)


    Hi there,

    Using the events calendar to good effect on this site, however there’s one thing that’s confusing people:

    https://surreyhorticulturalfederation.org/?s=talk&searchsubmit=U

    You’ll see that each event has a date in the past – because it’s the date the event post was created, not the date of the event itself. This is causing mass confusion for users of the site, as they search for their event and then complain it’s showing on the wrong date….

    Before I start to reverse-engineer the events calendar to put a fix in for this, does anyone know if there’s a quick fix to show the event date in the search results, rather than the date the event was created?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi @webreaper,

    Thanks so much for reaching out and sorry for the trouble! I’m happy to help troubleshoot this with you to see what’s happening.

    First of all, please make sure you are using the latest version of our plugins. Once you’ve done that, will you please follow the steps outlined in this article? This will allow us to determine if there is a problem in our plugin or a conflict with the theme or other installed plugins.

    Let’s start there and see what we find!

    Thanks,
    Caroline

    Thread Starter Webreaper

    (@webreaper)

    Hi Caroline,

    There is no problem in the plugin or conflict with the theme. I’m looking to change the template in used by the search results. Also, disabling all of my plugins and switching to another theme is, as you can imagine, a huge amount of work and will likely break my entire site, which I can’t do in production.

    Perhaps you can confirm to me whether the plugin is designed to display the event start date in the search results template first, and then if not, explain to me how I can change this?

    Bit disappointed that I’ve waited all week for your response on ‘Support Wednesday’ and then just get this response to my post. Did you actually read my question?

    Mark

    Hi Mark,

    Sorry for the confusion here — your follow-up clarifies things a lot and is much appreciated.

    There is no setting in the plugin that will change the appearance of how Events appear alongside normal Posts in search results. The default search template will treat Events the same as Posts, which use the publish date instead of the event start date.

    What you may need to do is update the theme’s search template so that the loop distinguishes between Events and Posts and has a different appearance for posts where tribe_get_start_date is used to output the date instead of the default Post publish date.

    Sorry we don’t have a more concrete example of this sort of customization available, but I hope it at least helps get the ball rolling in the right direction.

    Cheers,
    Geoff

    Thread Starter Webreaper

    (@webreaper)

    Thanks, that’s what I was looking for. I’ll have to see if I can put together a filter that does this. Might be a good idea as a future enhancement for the plugin.

    If I get something working, I’ll post back here.

    Thread Starter Webreaper

    (@webreaper)

    Quick update: I managed to solve this by:

    1. Turning off breadcrumbs for the Happenstance theme I was using (which stopped the post-date being displayed in the search results.
    2. Adding the event date to the excerpt, by adding this filter:

    function search_event_date_filter( $content ) {
        global $post;
        if( 'tribe_events' == $post->post_type && is_search() && ! is_single()  )
        {
            $custom_content = '';
            $custom_content = '<ul><li>Event Date: <strong>' . tribe_get_start_date() . '</strong></li></ul>';
            if( ! empty( $content ) )
                $custom_content .= $content;
    
            return $custom_content;
        }
    
        return $content;
    }
    add_filter( 'the_content', 'search_event_date_filter', 11 );

    Hope this helps anyone else who needs this functionality.

    • This reply was modified 8 years, 3 months ago by Webreaper.

    Hey @webreaper,

    Glad to see you found a solution! Be sure to reach out in the future if you have questions. ??

    Best,

    Shelby

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Showing the event date on the search template’ is closed to new replies.