Customize Individual Event Category Archive

Home Forums Calendar Products Events Calendar PRO Customize Individual Event Category Archive

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1113385
    Josh Fialkoff
    Participant

    Is 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?

    #1113407
    Geoff
    Member

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

    #1113491
    Josh Fialkoff
    Participant

    which function do you suggest and where should it be included in the list/content.php?

    #1113738
    Geoff
    Member

    I 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!
    Geoff

    #1114069
    Josh Fialkoff
    Participant

    Hey 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?

    #1114234
    Geoff
    Member

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

    #1114304
    Josh Fialkoff
    Participant

    It did not work on my page – do you mind posting the full code of your list/content.php page?

    #1114305
    Josh Fialkoff
    Participant

    nvm! it worked. Thank you so much Geoff.

    #1114409
    Geoff
    Member

    My pleasure! Thanks for following up to let me know. 🙂

    Cheers,
    Geoff

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Customize Individual Event Category Archive’ is closed to new replies.