Category Pages – unique html content

Home Forums Calendar Products Events Calendar PRO Category Pages – unique html content

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1131177
    CTC
    Participant

    Hello,

    In the display tab of settings, I put some custom html to be displayed before the events content. It looks great.

    I’m wondering, however, if I can change this HTML in the pages that are generated from categories. For example, /events/category/architecture/.

    Can I add custom HTML JUST for this and other category page(s)?

    Thank you in advance and thank you for all of your support thus far.

    -Ben

    #1131425
    Nico
    Member

    Hey Ben,

    Thanks for reaching out to us on this!

    What you describe sounds possible with the help of a code snippet, but surely not doable from the Event Settings. If you use a snippet for this the content for the category pages will be ‘hardcoded’ into the snippet, this means you won’t be able to edit it like you do with the default html field. Do you think this solutions works for you anyway?

    Please let me know about it,
    Best,
    Nico

    #1131439
    CTC
    Participant

    Hi Nico,

    Thank you for the response. Yes, the code snipped option sounds ideal. The question is, can I create unique HTML content for EACH category page. So, one code snipped for the ‘architecture’ category page, another for the ‘online’ category page, etc.

    Is this possilbe? And if so, where do I place these code snippets?

    Thank you,
    Ben

    #1132607
    Nico
    Member

    Thanks for confirming Ben!

    Place the following snippet in the functions.php file of your theme (or child theme):


    // Tribe show specific content for cats
    function category_tribe_events_before_html ( $before ){

    if ( tribe_is_event_category() ) {

    $cat = get_queried_object();

    if ( 'architecture' == $cat->slug ) {
    $before = 'Custom before text for architecture cat';
    } else if ( 'online' == $cat->slug ) {
    $before = 'Custom before text for online cat';
    }
    }

    return $before;
    }

    add_filter( 'tribe_events_before_html', 'category_tribe_events_before_html' );

    Give a try and let me know if it works for you,
    Best,
    Nico

    #1138721
    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 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Category Pages – unique html content’ is closed to new replies.