Mini calendar – change previous/next buttons

Home Forums Calendar Products Events Calendar PRO Mini calendar – change previous/next buttons

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1150125
    Megan Sukys
    Participant

    I found this post:

    Change next/previous buttons to icons

    In grid.php you call tribe_events_the_mini_calendar_prev_link() and tribe_events_the_mini_calendar_next_link(). However these functions return a fully formed HTML link, meaning it isn’t directly possible to change the icon used.

    I tried adding /my-theme/tribe-events/pro/functions/template-tags/widgets.php with a duplicate of one of the above functions but that does not appear to override the function defined in the plugin widgets.php file.

    Can you help me determine where I can override this hard-coding of the previous/next icons?

    #1150368
    Brook
    Participant

    Howdy Ryan!

    I would love to help you with this.

    If you want that function to return just the URL you could take advantage of the filter at the end of it:

    function tribe_events_the_mini_calendar_next_link_url() {
    	$tribe_ecp = Tribe__Events__Main::instance();
    	$args      = tribe_events_get_mini_calendar_args();
    	$url       = $tribe_ecp->nextMonth( $args['eventDate'] );
    	
    	return $url;
    }
    
    add_filter( 'tribe_events_the_mini_calendar_next_link', 'tribe_events_the_mini_calendar_next_link_url' );

    Inserting that into your functions.php should make it return just the URL. Or, you can now simply call tribe_events_the_mini_calendar_next_link_url() directly to retrieve the URL.

    Does that all make sense? Will that work for you? Please let me know.

    Cheers!

    – Brook

    #1150649
    Megan Sukys
    Participant

    Perfect. I added the HTML back within the function to keep it all in one place, and specified the Font Awesome characters I wanted to use:

    function tribe_events_the_mini_calendar_next_link_url() {
    $tribe_ecp = Tribe__Events__Main::instance();
    $args = tribe_events_get_mini_calendar_args();
    $url = $tribe_ecp->nextMonth( $args[‘eventDate’] );
    $html = ‘<i class=”fa fa-caret-right”></i>‘;

    return $html;
    }

    add_filter( ‘tribe_events_the_mini_calendar_next_link’, ‘tribe_events_the_mini_calendar_next_link_url’ );

    #1150680
    Brook
    Participant

    Awesome! Thanks for sharing the code.

    Cheers!

    – Brook

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Mini calendar – change previous/next buttons’ is closed to new replies.