• Resolved 1000camels

    (@1000camels)


    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/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter 1000camels

    (@1000camels)

    Ok, i think my suggestion above is incorrect. What really needs to change is how the taxonomy is created. In the same class file on line 820, the line needs to look like this:

    ‘rewrite’ => array(‘slug’=> $this->taxRewriteSlug, ‘with_front’=>false),

    The with_front makes sure that the url setting for categories is not prepended. Althought this may change the way that some people use their system, I would suggest that this makes more sense as it roots the categories under the ‘events’ slug. And as I pointed out above, this is only a bug for those running more of a CMS, in which the posts are rooted under another permalink.

    Hey there 1000camels. Thanks for the note on this, and for sharing your ideas. While what you’ve noted here goes a bit beyond my area of expertise I have asked our lead dev on this plugin to take a look and see what he can offer up. If incorporating some code in a future release that modifies this would be a viable option, we’ll definitely get it logged in the system. Stay tuned and we’ll see what the dev has to say!

    Hi again 1000camels. I had our developer Paul take a look at this and he confirmed that there was indeed a bug; we’ve since patched that and will have the fix included in our 2.0.7 release that will launch the first week of June.

    Thanks for the heads up in bringing this to our attention. Let me know if you need anything else down the road.

    Thread Starter 1000camels

    (@1000camels)

    Thank you for applying this fix.

    Thank you for bringing it to our attention, 1000camels. As a token of our appreciation…if you ever want to update to PRO (or snag an add-on) shoot us an email referencing this thread, pro /a/ tri.be, and we’ll see about hooking you up with a discount code as a token of our thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: The Events Calendar] Potential bug with category url’ is closed to new replies.