Change / Replace the word "All Events" depends on the post category

Home Forums Calendar Products Events Calendar PRO Change / Replace the word "All Events" depends on the post category

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1421629
    allegrafalsecreek
    Participant

    I divided my events page into Events and Store Specials.
    I’d like to change the “All Events” button to “All Store Specials” for post in “Store Specials” category.
    Is there any way to replace the “All Events” to “All Store Specials” only when the post is in Store Specials category? like if the page has the word “Store Specials”?

    #1421635
    allegrafalsecreek
    Participant

    This reply is private.

    #1422681
    allegrafalsecreek
    Participant

    I hope this would be clearer description of what I want to achieve…

    I found I might be able to customize it in tribe-events/single-event.php

    <a class="cmsmasters_theme_icon_date" href="”>

    Is it possible to change “All %s” to All “category” so it will display the event category name after “All” and link to the event category page?

    #1422718
    Crisoforo
    Keymaster

    Hey!

    Thanks for reaching out to our forums, this is something you can archive by creating a custom template for the view single-event.php, for more details in how this works you can take a look at our Themer’s guide.

    Once you have a view for this file in your theme you need to  replace the following line:

     <p class="tribe-events-back">
     <a href="<?php echo esc_url( tribe_get_events_link() ); ?>"> <?php printf( '&laquo; ' . esc_html_x( 'All %s', '%s Events plural label', 'the-events-calendar' ), $events_label_plural ); ?></a>
     </p>

    By something like this.

     <p class="tribe-events-back">
     <?php if ( has_term( 'music', 'tribe_events_cat', get_the_ID() ) ) : ?>
     <a href="<?php echo esc_url( tribe_get_events_link() ); ?>"> <?php printf( '&laquo; ' . esc_html_x( 'All %s', '%s Music plural label', 'the-events-calendar' ), 'Music specials' ); ?></a>
     <?php else : ?>
     <a href="<?php echo esc_url( tribe_get_events_link() ); ?>"> <?php printf( '&laquo; ' . esc_html_x( 'All %s', '%s Events plural label', 'the-events-calendar' ), $events_label_plural ); ?></a>
     <?php endif; ?>
     </p>

    In the previous example will show a different message Music specials if the event displayed has the category music, you can change this by using a different category slug on the function has_term. If  the event does not have that category will display the regular link.

    Please let me know if you have any other questions about this issue or if there’s anything else I can do for you.

    Thanks,
    Crisoforo

    #1422767
    allegrafalsecreek
    Participant

    Thank you so much crisoforo, it worked!
    Now I just need to link it to the each category pages.
    “All Store Specials” button to Store Specials category page (http://new.centralcity.ca/events/category/store-specials/)
    and All Events button to Events category page (http://new.centralcity.ca/events/category/events/).
    How can I do this?

    #1422770
    Crisoforo
    Keymaster

    I’m glad that was useful. You only need to change the function tribe_get_events_link with

     get_term_link( 'music', 'tribe_events_cat' )

    Where the first part is the slug of the category you want to link to it and the second one is the taxonomy name of the category very similar to the example above where has_term is being used.

    So the example above will look into something like:

     <?php if ( has_term( 'music', 'tribe_events_cat', get_the_ID() ) ) : ?>
     <a href="<?php echo esc_url( get_term_link( 'music', 'tribe_events_cat' ) ); ?>"> <?php printf( '&laquo; ' . esc_html_x( 'All %s', '%s Music plural label', 'the-events-calendar' ), 'Music specials' ); ?></a>
     <?php else : ?>
     <a href="<?php echo esc_url( tribe_get_events_link() ); ?>"> <?php printf( '&laquo; ' . esc_html_x( 'All %s', '%s Events plural label', 'the-events-calendar' ), $events_label_plural ); ?></a>
     <?php endif; ?>

    Let me know if you have additional questions.

    Thanks,
    Crisoforo

    #1422782
    allegrafalsecreek
    Participant

    It works like a charm!
    The best support ever. Thank you so much!

    #1422798
    Crisoforo
    Keymaster

    Fantastic!

    Feel free to reach out again in the future if you have more questions issues, we are here to help you, have a great day.

    Thanks,
    Crisoforo

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Change / Replace the word "All Events" depends on the post category’ is closed to new replies.