Category Specific Single Event Template

Home Forums Calendar Products Events Calendar PRO Category Specific Single Event Template

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

    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,
    Dave

    #946166
    David Ruszkowski
    Participant

    I’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,
    Dave

    #946568
    George
    Participant

    Hey 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!
    George

    #946581
    David Ruszkowski
    Participant

    Thanks for the reply. Yes I am using the file from my theme folder.

    Here is the link: https://gist.github.com/BfStMedia/ff013a4e2949aa087789

    Thanks,
    Dave

    #946725
    George
    Participant

    Hey 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,
    George

    #983831
    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 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Category Specific Single Event Template’ is closed to new replies.