• Resolved jansena

    (@jansena)


    Hi,

    I had a problem with not having the previous and next month.
    After searching in this forum I found a fix that partially worked for me.
    I’m using the following code in my functions.php

    /**
     * Allows visitors to page forward/backwards in any direction within month view
     * an "infinite" number of times (ie, outwith the populated range of months).
     */
    if ( class_exists( 'Tribe__Events__Main' ) ) {
    	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 = Tribe__Events__Main::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 = Tribe__Events__Main::instance()->previousMonth( tribe_get_month_view_date() );
    	        return '<a data-month="' . $date . '" href="' . $url . '" rel="prev"><span>&laquo;</span> ' . $text . ' </a>';
    	    }
    	}
    	new ContinualMonthViewPagination;
    }
    

    Now I see the next/previous links, accept if I’m on march 2019, I don’t see the next link for April. If I go back on year for example march 2018 I can see the next month April, or if I go forward one year: march 2020 I can see the next April link.

    How does is come that for 2019 I can’t see the next link? I have no errors in the console log. If I look into the source code, I see that the anchor link doesn’t exist in the list.

    I’m running the latest wordpress version (Dutch) and latest plugin.

    Hope you can help me out.

    Regards,

    Arno

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey there,

    Thanks for reaching out 😄

    Do you have a live link for this site?

    Do you have any other customizations or hooks in your functions.php file?

    Take care,
    Ed 🤟

    Hey there,

    Since this topic has been inactive for a while, I’m going to go ahead and mark as resolved. Don’t hesitate to reopen or create a new topic if you still need help! 😄

    Take care,
    Ed 🤟

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Problem next/previous month (april)’ is closed to new replies.