Display a list of all categories with calendar subscribe links
-
I would like to output a list of all event categories with link to subscribe your personal calendar to the category.
-
Im trying to figure out how to first grab an array of categories and then grab the subscribe code which is usual on a individual category page
<?php $args = array( 'taxonomy' => 'tribe_events_cat', 'orderby' => 'name', 'order' => 'ASC' ); $cats = get_categories($args); foreach($cats as $cat) { ?> <a href="<?php echo get_category_link( $cat->term_id ) ?>"> <?php echo $cat->name; ?> </a><?php foreach ( $items as $item ) : ?> <?php $this->template( 'components/subscribe-links/item', [ 'item' => $item ] ); ?> <?php endforeach; ?> <?php } ?>
To help find the relevant code – This is what creates the subscribe button so look around the subscribe-links pages for the code to use.
the-events-calendar/src/views/v2/compenents/subscribe-links/list.php<?php foreach ( $items as $item ) : ?> <?php $this->template( 'components/subscribe-links/item', [ 'item' => $item ] ); ?> <?php endforeach; ?>
https://stackoverflow.com/questions/39652122/how-to-list-all-category-from-custom-post-type
Im following these suggestions to get an array of custom post type categories. In this case its ‘taxonomy’ => ‘tribe_events_cat’,I need to output a list and inside each
- item it will include the category name and the subscribe button for that category.
On the demo you can see the subscribe button at the bottom right https://demo.theeventscalendar.com/events/category/live-events/
It Should look like this in the end https://www.screencast.com/t/ksIt2UEbt
-
This reply was modified 3 years, 3 months ago by
davidjs.
Hi @davidjs,
This is not something that particular code supports in a super easy way, but I am logging a ticket to the Developer that created that piece of our product so that we can implement something that would make that easier.
Currently the best way to add other lists is to create a completely custom code which you are in the correct path, but we are having a super high support surge now and we dont have the available people to help you with the customization much further.
But if you keep me updated here on how far you got or where you are stuck I can give you pointers on the correct direction.
So far it feels like what you got is in the correct direction.
But you might need to overwrite the
[your-theme]/tribe/events/v2/components/subscribe-links/item.php
since there is a check inside that prevents anything that is not an instance ofLink_Abstract
to be rendered, which can make your code get a little to complicated.Best Regards,
I have no clue where to go with this. I was inspired by nascar which uses a 3rd party calendar service. They have a +calendar icon that opens a modal and lets people select categories of events to subscribe to. The events calendar can do this if we can output this list with the subscribe links.
https://www.nascar.com/nascar-cup-series/2022/schedule/#Ohh I see what you mean.
Unfortunately this level of customization is out of the bounds what I can provide you.
Like I mentioned above I can give you or a developer working with you pointers of where to look in our codebase to get started, but this is 100% a custom feature so we really dont have the time to craft it.
best regards,
- item it will include the category name and the subscribe button for that category.
- The topic ‘Display a list of all categories with calendar subscribe links’ is closed to new replies.