Event Specific Template

Home Forums Calendar Products Events Calendar PRO Event Specific Template

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #947879
    David Ruszkowski
    Participant

    Hello, I am looking to make a single event template that is only used for a specific event. Mt thinking would be that I would just create another single-event.php file with a name with something like this: single-event-event-slug.php or single-event-ID.php. The event-slug or ID being the slug or ID of the event the template is for. Am I correct in this approach or is it set up differently?

    Thanks so much,
    Dave

    #947930
    Geoff
    Member

    Hey there, Dave! Welcome back to the forums. 🙂

    Good question! The way I would go about it is to override the single-event.php template and wrap it in a PHP condition like:

    // Replace $id with a specific event post ID
    <?php if ( tribe_is_event( $id ) ) {
    // Event-specific stuff
    }
    else {
    // All normal layout stuff
    } ?>

    That’s just a rough idea, so tweak it as needed, but it should help get you off the ground. 🙂

    Cheers!
    Geoff

    • This reply was modified 11 years, 1 month ago by Geoff.
    #947940
    David Ruszkowski
    Participant

    Thanks for the reply… it is working however it showing on every event post. I am displaying an audio player on a page that is specific to a concert with a shortcode. I wonder what I am missing? Here is what I added to single-event.php.

    <?php if ( tribe_is_event( '842' ) ) {
    echo do_shortcode('[wonderplugin_audio id="1"]');
    }
    else {} ?>

    The event post ID is 842, if it is not that id, nothing should be displayed. I know I can just add the shortcode in the WordPress editor, but I need it in a specific place on the page, above the title.

    #947999
    Geoff
    Member

    Ah, gotcha. If that’s the case, perhaps you can try using the same sort of condition, but hook into the tribe_events_before_html() function. This would allow you to inject the shortcode above the header without actually touching the template.

    Here’s a rough example to get you started, in case it helps. 🙂

    Cheers!
    Geoff

     

    #948040
    David Ruszkowski
    Participant

    I found a different plugin with a player that fits better right in the WordPress editor so I not going to use this method. Thanks for the help, though as I am sure it will be helpful at some point down the road.

    Thanks again,
    Dave

    #948144
    Geoff
    Member

    My pleasure, thanks for following up! Feel free to hit us up with a new thread if any other questions come up and we’d be happy to help. 🙂

    Geoff

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Event Specific Template’ is closed to new replies.