Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Showing Category Name with Color and Link to category filter page

$
0
0

Replies: 0

Hi, I added a category.php inside the
the-events-calendar/src/views/v2/widgets/widget-events-list/

folder

and I modified the the-events-calendar/src/views/v2/widgets/widget-events-list/event.php in order to show the name of the category with a link to its page filtering events by that category. Just in case somebody wants to use it or if you want to include in future versions of this plugin.

Here is the code:
Addition to the-events-calendar/src/views/v2/widgets/widget-events-list/event.php

<header class=”tribe-events-widget-events-list__event-header”>

<?php $this->template( ‘widgets/widget-events-list/event/date’, [ ‘event’ => $event ] ); ?>
<?php $this->template( ‘widgets/widget-events-list/event/title’, [ ‘event’ => $event ] ); ?>
<?php $this->template( ‘widgets/widget-events-list/event/category’, [ ‘event’ => $event ] ); ?>

</header>

New Addition to the-events-calendar/src/views/v2/widgets/widget-events-list/category.php


<?php
$lang=get_bloginfo(“language”);
$terms = wp_get_post_terms($event->ID, ‘tribe_events_cat’, array(“fields” => “all”));

if ( !empty( $terms ) && !is_wp_error( $terms ) ){
echo “

“;
}
?>


Viewing all articles
Browse latest Browse all 59525

Trending Articles