Home › Forums › Calendar Products › Events Calendar PRO › Customize Individual Event Category Archive
- This topic has 8 replies, 2 voices, and was last updated 9 years, 11 months ago by
Geoff.
-
AuthorPosts
-
May 11, 2016 at 12:38 pm #1113385
Josh Fialkoff
ParticipantIs there a way to customize individual event category pages, such as http://staging.btu.org/events/category/prof-learning-conf/?
When I change the list/content.php file it changes all of the event category templates – I need a way to change only one event category template. I have tried if ( ! defined( ‘ABSPATH’ ) ) {
die( ‘-1’ );
}do_action( ‘tribe_events_before_template’ );
?><!– Tribe Bar –>
<?php tribe_get_template_part( ‘modules/bar’ ); ?><!– Main Events Content –>
if(tribe_meta_event_category_name() == ‘Professional Learning Conference’){
<?php tribe_get_template_part( ‘list/prof-learning-conf-content’ ); ?>
} else {
<?php tribe_get_template_part( ‘list/content’ ); ?>
}
<div cla ss=”tribe-clear”></div><?php
do_action( ‘tribe_events_after_template’ );but that does not seem to work.
Is there a way to write a conditional statement so that event calendars know when to use a specific customize template for event categories?
May 11, 2016 at 12:57 pm #1113407Geoff
MemberHey Josh!
Good question. If you are trying to make a styling change, then you can use the .events-category-prof-learning-conf class to make changes specifically to that page.
If, however, you are making markup changes to the template, then I would recommend hooking into the functions where the markup is included and writing a filter wrapped in a conditional statement that checks for that specific category archive. For example:
<?php if( tribe_is_past() || tribe_is_upcoming() && is_tax( 'prof-learning-conf' ) ) { // Your code ?>You can find all of our functions right here in our documentation.
Will this help you get started? Please let me know. 🙂
Cheers!
GeoffMay 11, 2016 at 3:37 pm #1113491Josh Fialkoff
Participantwhich function do you suggest and where should it be included in the list/content.php?
May 12, 2016 at 7:20 am #1113738Geoff
MemberI think it really depends on what you are trying to do with the template — different functions have different utilities, so it ultimately depends on what sort of changes you are trying to make.
Another idea (and possibly a better one) would be to use the same sort of conditional statement directly in the template. That would allow you to change the markup for that specific page without it affecting the others.
So, it’s the same concept, but applied directly in list/content.php:
<?php if( tribe_is_past() || tribe_is_upcoming() && is_tax( 'prof-learning-conf' ) ) { // Your code ?>The markup inside that statement will apply only to the prof-learning-conf category page and nothing else.
Does that make sense and sound like a better approach?
Thanks!
GeoffMay 12, 2016 at 4:25 pm #1114069Josh Fialkoff
ParticipantHey Geoff,
adding <?php if( tribe_is_past() || tribe_is_upcoming() && is_tax( ‘prof-learning-conf’ ) ) {
// Your code
?>
into list/content.php did not work – it just broke the page. Is there another way you would suggest?May 13, 2016 at 7:22 am #1114234Geoff
MemberHey Josh,
I tested this and it worked on my test site:
<?php if( tribe_is_upcoming() || tribe_is_past() && tribe_is_event_category( 'prof-learning-conf’' ) ) { echo 'Hello!'; }?>Does that work for you as well?
Thanks,
GeoffMay 13, 2016 at 9:27 am #1114304Josh Fialkoff
ParticipantIt did not work on my page – do you mind posting the full code of your list/content.php page?
May 13, 2016 at 9:30 am #1114305Josh Fialkoff
Participantnvm! it worked. Thank you so much Geoff.
May 13, 2016 at 12:16 pm #1114409Geoff
MemberMy pleasure! Thanks for following up to let me know. 🙂
Cheers,
Geoff -
AuthorPosts
- The topic ‘Customize Individual Event Category Archive’ is closed to new replies.
