[Plugin: The Events Calendar] Potential bug with category url
-
Hi,
I think I’ve discovered a bug with how the events category urls are set. Everything works fine if your site runs like a normal blog, but as soon as you change the category permalink structure to include another prefix (ie. /news/), the category slugs don’t work as I would expect.
The issue is that this plugin allows you to set the slug events. I am using ‘events’ and ‘event’. My permalink structure looks like this: “/news/%year%/%monthnum%/%day%/%postname%/”
Given how the urls work in every place except the categories, I would expect my category URLs to look like ‘/events/category/lecture/upcoming’, and not ‘/news/events/category/lecture/upcoming’. This occurs because the url is built using get_term_link(). I posit and below provide an example of one way in which this can be fixed.
I appreciate your thoughts and feedback on this:
the-events-calendar.class.php: lines 1424-1431
// if we’re on an Event Cat, show the cat link, except for home and days.
if ( $type !== ‘home’ && $type !== ‘day’ && is_tax( self::TAXONOMY ) ) {
//$eventUrl = trailingslashit( get_term_link( get_query_var(‘term’), self::TAXONOMY ) );
$eventUrl = trailingslashit( home_url() . ‘/’ . sanitize_title($this->getOption(‘eventSlug’, ‘events’)) . ‘/category/’ . get_query_var(‘term’) );
} else if ( $term ) {
//$eventUrl = trailingslashit( get_term_link( $term, self::TAXONOMY ) );
$eventUrl = trailingslashit( home_url() . ‘/’ . sanitize_title($this->getOption(‘eventSlug’, ‘events’)) . ‘/category/’ . $term );
}https://www.ads-software.com/extend/plugins/the-events-calendar/
- The topic ‘[Plugin: The Events Calendar] Potential bug with category url’ is closed to new replies.