Thursday, 19 July 2018

How to Add Next Previous links to The Event Calendar

Add Next/Previous links to The Event Calendar Wordpress Plugin

Add code to your child theme’s functions.php file

/**
 * Allows visitors to page forward/backwards in any direction within month view
*/

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;

}

12 comments:

  1. I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site.Block Chain Training in chennai

    Block Chain Training in annanagar

    Block Chain Training in pune

    Block Chain Training in velachery

    ReplyDelete
  2. I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site.Block Chain Training in chennai

    Block Chain Training in annanagar

    Block Chain Training in pune

    Block Chain Training in velachery

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.


    rpa training in chennai | best rpa training in chennai | rpa training in chennai | rpa training in bangalore
    rpa training in pune | rpa online training

    ReplyDelete
  6. I really enjoy simply reading all of your weblogs. Simply wanted to inform you that you have people like me who appreciate your work. Definitely a great post I would like to read this
    Data Science Training in Chennai | Data Science training in anna nagar
    Data Science training in chennai | Data science training in Bangalore
    Data Science training in marathahalli | Data Science training in btm

    ReplyDelete
  7. Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.
    java training in chennai

    java training in marathahalli | java training in btm layout

    ReplyDelete
  8. I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own BlogEngine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it.
    python training Course in chennai
    python training in Bangalore
    Python training institute in kalyan nagar

    ReplyDelete
  9. A very nice guide. I will definitely follow these tips. Thank you for sharing such detailed article. I am learning a lot from you.

    rpa training in electronic-city | rpa training in btm | rpa training in marathahalli | rpa training in pune

    ReplyDelete
  10. Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here.
    Best Devops Training in pune

    ReplyDelete