WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [Plugin: The Events Calendar] List Widget's View All Events points to wrong category (2 posts)

  1. justinendler
    Member
    Posted 4 years ago #

    "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, both events_get_gridview_link() and events_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

  2. kgagne
    Member
    Posted 4 years ago #

    I made these changes starting at lines 655 & 668 and have confirmed that the fix works. Thanks, Justin!

Topic Closed

This topic has been closed to new replies.

About this Topic