Next Month Link Auto-hide

Home Forums Calendar Products Events Calendar PRO Next Month Link Auto-hide

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #813855
    ronanoleary
    Participant

    Hi,
    Just wondering if there is a way to disable the auto-hide function for the “next month” link on month view in the case of there being no events actually listed for the next month. I sometimes have events listed for 2 months in the future but nothing for the month in between – so the absence of the next month link in this case makes navigation a little more awkward. Apologies if this question has been answered already. Thanks, Ronan.

    #814126
    Barry
    Member

    Hi there ronanoleary,

    It shouldn’t hide the next month link unless there truly are no events in the future.

    In other words, if you have events in October then nothing in November or December but you do have a further event in January, it will still let you cycle through the months as far as January (if that is when the furthest-in-the-future event within your calendar is taking place).

    Are you experiencing something other than this/can you point me to an example?

    Thanks!

    #814134
    Barry
    Member

    …Just to add, if you want those links to display regardless you can try adding this snippet 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;

    (If there’s a bug though and you’re not seeing the links appear when they should – ie, when there are future events – it would be awesome to see it first hand and potentially fix it as I can’t seem to replicate the same thing locally and we’d love to get a little more insight if it’s a bug that might impact others.)

    Thanks again!

    #846632
    Barry
    Member

    Hi! It’s been a while so I’m going to go ahead and close this thread. If we can help with anything else, though, please don’t hesitate to create new threads as needed. Thanks!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Next Month Link Auto-hide’ is closed to new replies.