Home › Forums › Calendar Products › Events Calendar PRO › Event Specific Template
- This topic has 5 replies, 2 voices, and was last updated 11 years, 1 month ago by
Geoff.
-
AuthorPosts
-
March 12, 2015 at 7:37 am #947879
David Ruszkowski
ParticipantHello, 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,
DaveMarch 12, 2015 at 10:50 am #947930Geoff
MemberHey 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.
March 12, 2015 at 11:05 am #947940David Ruszkowski
ParticipantThanks 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.
March 12, 2015 at 2:25 pm #947999Geoff
MemberAh, 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!
GeoffMarch 12, 2015 at 8:00 pm #948040David Ruszkowski
ParticipantI 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,
DaveMarch 13, 2015 at 8:06 am #948144Geoff
MemberMy 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
-
This reply was modified 11 years, 1 month ago by
-
AuthorPosts
- The topic ‘Event Specific Template’ is closed to new replies.
