Home › Forums › Calendar Products › Events Calendar PRO › Category Specific Single Event Template
- This topic has 5 replies, 3 voices, and was last updated 8 years, 10 months ago by Support Droid.
-
AuthorPosts
-
March 5, 2015 at 7:03 am #946145David RuszkowskiParticipant
Hello I would like to create a specific single event template based on the category the event is in. I tried doing something like this is loop.php…
<div id="post-<?php the_ID() ?>" class="<?php tribe_events_event_classes() ?>"> <?php if ( in_category('20') ) { include(TEMPLATEPATH . 'tribe-events/hunts-single.php'); } else { tribe_get_template_part( 'list/single', 'event' ); } ?> </div>
This doesn’t seem to be doing anything, I wonder if I am not calling the category correctly.
Any help you could offer would be great.
Thanks,
DaveMarch 5, 2015 at 7:55 am #946166David RuszkowskiParticipantI’ve also tried this, nothing really happening…
<div id="post-<?php the_ID() ?>" class="<?php tribe_events_event_classes() ?>"> <?php $args = array( 'post_type' => 'tribe_events', 'tribe_events_cat' => 'hunts' ); // The Query if ( tribe_events_cat('hunts') ) { include(TEMPLATEPATH . 'tribe-events/hunts-single.php'); } else { tribe_get_template_part( 'list/single', 'event' ); //Don't forget to reset the query wp_reset_query(); ?> </div>
I must be missing something somewhere.
Thanks,
DaveMarch 6, 2015 at 11:17 am #946568GeorgeParticipantHey Dave,
Thanks for reaching out to us – I’m curious, have you been modifying “loop.php” within the Events Calendar plugin files directly? Or are you using a customized template from within your theme, as we recommend?
If you’re not using a custom version of the template from within your theme, then the first thing I’d recommend is to revert the “loop.php” file in your core plugin files back to its original state, and then put your customized loop.php file into your theme as described in our official Themer’s Guide here → https://theeventscalendar.com/knowledgebase/themers-guide/?source=tri.be
Just a recommendation there, you may already have things configured this way.
Once you’re squared away on this, can you copy and paste the entirety of your customized file, un-edited, into a Gist at http://gist.github.com and share a link to that Gist here in the support ticket? We’ll take a closer look.
Thanks!
GeorgeMarch 6, 2015 at 11:58 am #946581David RuszkowskiParticipantThanks for the reply. Yes I am using the file from my theme folder.
Here is the link: https://gist.github.com/BfStMedia/ff013a4e2949aa087789
Thanks,
DaveMarch 7, 2015 at 12:41 pm #946725GeorgeParticipantHey Dave,
Thanks for sharing that.
tribe_events_cat() is not a function – what you might be able to try instead is something like this:
if ( 'hunts' == tribe_meta_event_category_name() ) {
And proceed with that. I hope that helps – let me know if it does!
Also, one thing that might help too, is that there’s a function within WordPress called get_template_part() that we modeled our own tribe_get_template_part() off of – you can use get_template_part() instead of using TEMPLATEPATH and such, it might help. Learn more about get_template_part() here → http://codex.wordpress.org/Function_Reference/get_template_part
Cheers,
GeorgeJuly 7, 2015 at 6:31 am #983831Support DroidKeymasterThis 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. -
AuthorPosts
- The topic ‘Category Specific Single Event Template’ is closed to new replies.