[Plugin: The Events Calendar] List Widget’s View All Events points to wrong category
-
“In events-class-widget.php, the link to “View All Events” does not work if viewing a non-events category of blog posts. For example, if viewing example.com/category/fundraising, “View All Events” tries to link to example.com/category/fundraising/upcoming instead of example.com/category/events/upcoming”
– kgagne
This is an oops. In
template-tags.php
, bothevents_get_gridview_link()
andevents_get_listview_link()
need redefined as:function events_get_gridview_link() { global $spEvents; $mainEventsCat = $spEvents->eventCategory(); $currentCat = get_query_var( 'cat' ); $cat_id = cat_is_ancestor_of( $mainEventsCat, $currentCat ) ? $currentCat : $mainEventsCat; $link = get_category_link( $cat_id ); if( '' == get_option('permalink_structure') || 'off' == eventsGetOptionValue('useRewriteRules','on') ) { return add_query_arg( array('eventDisplay'=>'month'), $link ); } else { return trailingslashit( $link ) . 'month'; } }
and
function events_get_listview_link( ) { global $spEvents; $mainEventsCat = $spEvents->eventCategory(); $currentCat = get_query_var( 'cat' ); $cat_id = cat_is_ancestor_of( $mainEventsCat, $currentCat ) ? $currentCat : $mainEventsCat; $link = get_category_link( $cat_id ); if( '' == get_option('permalink_structure') || 'off' == eventsGetOptionValue('useRewriteRules','on') ) { return add_query_arg( array('eventDisplay'=>'upcoming'), $link ); } else { return trailingslashit( $link ) . 'upcoming'; } }
Assuming this fixes the problem and still allows for the usage of sub-categories of Events, some other functions of this type will include the same change in the next release. For now, they shouldn’t cause problems.
Justin
- The topic ‘[Plugin: The Events Calendar] List Widget’s View All Events points to wrong category’ is closed to new replies.