Navigation/Scroll Functionality

Home Forums Calendar Products Events Calendar PRO Navigation/Scroll Functionality

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #749831
    Tom
    Participant

    What I have noticed was an inability to browse/scroll through the calendar unless there are events in the past or future. Without some event in or beyond a month you may wish to view, there is no way to navigate to said month other than via the date picker function of the search bar. I understand that this functionality may have been in the product at some point and subsequently removed for those wishing to maximize their SEO.

    I was wondering, if you would be able to assist with a snippet of code that would restore this functionality via a template override and if it proves useful to the community to have this ability, maybe add it back as a feature that could be enabled/disabled via Events -> Settings. This will allow the calendar to function like most default calendars

    Thanks for your assistance.

    #751240
    Barry
    Member

    Hi Tom,

    We did indeed make that change as part of a response to a number of customer concerns: it’s possible to restore the previous behaviour, though, and if you want to give that a try please add the following code to your theme’s functions.php file:

    /**
     * Allows visitors to page forward/backwards in any direction within month view
     * an "infinite" number of times (ie, outwith the populated range of months).
     */
    class ContinualMonthViewPagination {
    	public function __construct() {
    		add_filter( 'tribe_events_the_next_month_link', array( $this, 'next_month' ) );
    		add_filter( 'tribe_events_the_previous_month_link', array( $this, 'previous_month' ) );
    	}
    
    	public function next_month() {
    		$url = tribe_get_next_month_link();
    		$text = tribe_get_next_month_text();
    		$date = TribeEvents::instance()->nextMonth( tribe_get_month_view_date() );
    		return '<a data-month="' . $date . '" href="' . $url . '" rel="next">' . $text . ' <span>&raquo;</span></a>';
    	}
    
    	public function previous_month() {
    		$url = tribe_get_previous_month_link();
    		$text = tribe_get_previous_month_text();
    		$date = TribeEvents::instance()->previousMonth( tribe_get_month_view_date() );
    		return '<a data-month="' . $date . '" href="' . $url . '" rel="prev"><span>&laquo;</span> ' . $text . ' </a>';
    	}
    }
    
    new ContinualMonthViewPagination;

    Does that work for you?

    #751987
    Tom
    Participant

    This reply is private.

    #751991
    Tom
    Participant

    *** Sorry didn’t mean to mark the answer as private ***
    Hi Barry,

    This is awesome and does exactly what I need it to do. Thank you very much.

    If you don’t mind my asking. Is there a simple way to move it to the top of the calendar? If its a big deal don’t sweat it, the functionality I need is here. I just think it would serve better at the top of the calendar to assist user’s with laptops from having to scroll down.

    Thanks again, this was awesome.

    #752033
    Tom
    Participant

    The answer to my followup question can be found here:
    https://tri.be/support/forums/topic/next-month-navigation-at-top/
    Thanks again for your assistance.

    #752899
    Barry
    Member

    Sorry Tom, I’d wrapped up my round of support work for the day when you posted your follow ups – glad you found that link in any case 🙂

    Thanks again!

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Navigation/Scroll Functionality’ is closed to new replies.