Events+ Calendar shortcode navigation bug

When you add the calendar to any page with this code: [eab_calendar navigation="yes" track="yes"] the Next month and next year adds one more month to the expected month. For example when you at Aug and click next month you will get Oct. It should be September.

  • Ash

    Hello Neil Batchelor

    Please go to /wp-content/plugins/events-and-bookings/lib/class_eab_calendar_helper.php line no 592 and replace the entire _get_navigation_row function with the following:

    protected function _get_navigation_row ($position) {
    		if (!$this->_navigation) return false;
    
    		global $post;
    
    		$time = $this->get_timestamp();
    
    		$calendar_class = $this->get_calendar_class();
    		$row_class = "eab-calendar-title {$calendar_class}-title-{$position}";
    
    		$short_attribute = $this->_short_title_format
    			? 'datetime="' . esc_attr(date_i18n($this->_short_title_format, $time)) . '"'
    			: ''
    		;
    		$title_format = 'top' == $position
    			? date_i18n($this->_title_format, $time)
    			: date_i18n($this->_title_format, $time)
    		;
    		$title_link = '<a href="' . Eab_Template::get_archive_url($time, true) . '" class="' . $calendar_class . '-navigation-link eab-cuw-calendar_date">' .
    			"<time {$short_attribute}>" .
    				"<span>{$title_format}</span>" .
    			'</time>' .
    		'</a>';
    		$positional_id = $this->_track ? esc_attr('eab-calendar-' . preg_replace('/[^-_a-z0-9]/', '-', $calendar_class)) : '';
    		$id_attr = $this->_track ? "id='{$positional_id}'" : '';
    		$id_href = $this->_track ? "#{$positional_id}" : '';
    		$title = 'top' == $position
    			? "<h4 {$id_attr}>{$title_link}</h4>"
    			: "<b>{$title_link}</b>"
    		;
    
                    $title = apply_filters(
                                    'eab_calendar_title',
                                    $title,
                                    $position,
                                    $id_attr,
                                    $title_link
                                );
    
    		$offset = get_option( 'gmt_offset' ) * HOUR_IN_SECONDS;
    		$t = date_i18n( 'd', date( 'd' ) + $offset );
    
    		$prev_time = date( 'd' );
    		$next_time = date('t') - $t + 1;
    
    		return "<tr class='{$row_class}'>" .
    			'<td>' .
    				'<a class="' . $calendar_class . '-navigation-link eab-navigation-prev eab-time_unit-year" href="' .
    					esc_url(add_query_arg('date', date('Y-m', $time - (366*86400)))) . $id_href . '">' .
    					'&nbsp;&laquo;' .
    				'</a>' .
    			'</td>' .
    			'<td>' .
    				'<a class="' . $calendar_class . '-navigation-link eab-navigation-prev eab-time_unit-month" href="' .
    					esc_url(add_query_arg('date', date('Y-m', $time - ($prev_time*86400)))) . $id_href . '">' .
    					'&nbsp;&lsaquo;' .
    				'</a>' .
    			'</td>' .
    			'<td colspan="3" style="text-align:center;">' .
    				'<input type="hidden" class="eab-cuw-calendar_date" value="' . $time . '" />' .
    				$title .
    			'</td>' .
    			'<td>' .
    				'<a class="' . $calendar_class . '-navigation-link eab-navigation-next eab-time_unit-month" href="' .
    					esc_url(add_query_arg('date', date('Y-m', $time + ($next_time*86400)))) . $id_href . '">' .
    					'&rsaquo;&nbsp;' .
    				'</a>' .
    			'</td>' .
    			'<td>' .
    				'<a class="' . $calendar_class . '-navigation-link eab-navigation-next eab-time_unit-year" href="' .
    					esc_url(add_query_arg('date', date('Y-m', $time + (366*86400)))) . $id_href . '">' .
    					'&raquo;&nbsp;' .
    				'</a>' .
    			'</td>' .
    		'</tr>';
    	}

    Please let us know if that works for you.

    Hope it helps! Please feel free to ask more questions if you have any.

    Have a nice day!

    Cheers,
    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.