Home › Forums › Calendar Products › Events Calendar PRO › Change / Replace the word "All Events" depends on the post category
- This topic has 8 replies, 2 voices, and was last updated 8 years, 3 months ago by
allegrafalsecreek.
-
AuthorPosts
-
January 9, 2018 at 10:03 am #1421629
allegrafalsecreek
ParticipantI 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”?January 9, 2018 at 10:05 am #1421635allegrafalsecreek
ParticipantThis reply is private.
January 10, 2018 at 9:58 am #1422681allegrafalsecreek
ParticipantI 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?
January 10, 2018 at 10:28 am #1422718Crisoforo
KeymasterHey!
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( '« ' . 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( '« ' . 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( '« ' . 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,
CrisoforoJanuary 10, 2018 at 10:58 am #1422767allegrafalsecreek
ParticipantThank 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?January 10, 2018 at 11:02 am #1422770Crisoforo
KeymasterI’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( '« ' . 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( '« ' . 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,
CrisoforoJanuary 10, 2018 at 11:12 am #1422782allegrafalsecreek
ParticipantIt works like a charm!
The best support ever. Thank you so much!January 10, 2018 at 11:18 am #1422798Crisoforo
KeymasterFantastic!
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 -
AuthorPosts
- The topic ‘Change / Replace the word "All Events" depends on the post category’ is closed to new replies.
