Can't figure out which template to use for a single event

Home Forums Calendar Products Events Calendar PRO Can't figure out which template to use for a single event

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #65464
    Laura Yeffeth
    Participant

    I am trying to make a change to the single event template but I can’t figure out which template to customize. First I tried adding the logic listed on this page: https://gist.github.com/jo-snips/2415009 to determine which page it thinks I am on when on a single event. In this case, it does not think I am on a single event when I am. It does not print the text for the condition
    elseif( tribe_is_event() && is_single() ) {
    // Single Events
    }
    If I remove tribe_is_event() it does. So the single page is not falling under tribe_is_event(). Why would that be?

    In addition, according to this documentation: https://theeventscalendar.com/support/documentation/events-calendar-themers-guide/#viewstemplates, to customize templates I should create a folder called “tribe-events” in my theme and put any template files (found in /wp-content/plugins/events-calendar-pro/views/) into this folder. I did this, and tried adjusting any of the files called single-event.php (under day, week, map and photo) and nothing works. There is no list folder like there was for the non-Pro version or I would have tried there as well.

    I am not sure where else to look?

    Any assistance would be appreciated!
    Laura

    #65682
    Barry
    Member

    Hi Laura,

    With regards to the first question it’s difficult to say without seeing your actual code and knowing where and at what point in the request it is running – depending on the context there can be a “limbo period” where WordPress conditional tests will work as expected but it may still be too early to use those provided by The Events Calendar.

    For your second question, I can understand your confusion there and we’ll see if we can improve the guide. To provide a concrete example, an override for the single-event.php template for photo view should work if it is located at:

    {your_theme}/tribe-events/photo/single-event.php

    Does that help here?

    #65685
    Laura Yeffeth
    Participant

    Hi Barry,

    For the first question, I am simply on a single event page. I clicked through to a single event from the list of events. The URL is mydomain/event/event-slug. Shouldn’t that trigger the conditional statement for a single event? It understands that I am on a single page since is_single() is triggered, but it doesn’t understand that I am on an event page since tribe_is_event() is not.

    For the second question, no, unfortunately that doesn’t help. I understand that. My point was that I have tested every single-event.php file that there is and none of them change the single event page.

    I have:
    {your_theme}/tribe-events/photo/single-event.php
    {your_theme}/tribe-events/map/single-event.php
    {your_theme}/tribe-events/day/single-event.php
    There was no list folder in my latest event calendar pro installation. Where else could I possibly look?

    If I were to give you access to the code, would you take a look?

    #65697
    Barry
    Member

    Hi Laura,

    With regards to the first question what I’d ask if the following doesn’t help is that you create a new thread – we’d much rather handle different topics in different threads to avoid confusion.

    Basically though there are many factors that could be at play. If, as an example, you are using the default page template (check Events > Settings > Display to see if this is the case) and test using tribe_is_event() too early (before the loop, essentially) then it is destined to fail because of the way event content is injected into the template.

    On the other hand, if you are using the default events template you could test with tribe_is_event() much earlier – at the top of header.php ought to work, for example.

    For the second question, no, unfortunately that doesn’t help. I understand that. My point was that I have tested every single-event.php file that there is and none of them change the single event page.

    Oh I see – apologies for the misunderstanding.

    The default single-event.php template responsible for single event pages actually resides in the-events-calendar/views (it’s a core template, rather than a PRO one) and copying that to your theme’s tribe-events subdirectory ought to do the trick.

    Does that help?

    #65775
    Laura Yeffeth
    Participant

    Yes, that helps. Thanks.

    #65780
    Barry
    Member

    Great! I’ll go ahead and close this thread, but of course if you have any further questions please don’t hesitate to create new threads as needed 🙂

    #980789
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Can't figure out which template to use for a single event’ is closed to new replies.