Support » Plugin: XO Event Calendar » Next and Previous Text Change Hooks.

  • Resolved wparijat

    (@wparijat)


    Is there any filter hooks to change the Next and Previous month Text in XO Calendar.

    I only find xo_event_calendar_month_caption hook which helped me greatly in terms for changing the month caption but I also want that to happen for Next and Previous Months.

    Like [ < 2月 ] 2020. 3月 [ 4月 > ]

    Thank You!

    • This topic was modified 1 year, 1 month ago by wparijat.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author ishitaka

    (@ishitaka)

    Hi @wparijat

    What about using the xo_event_calendar_month hook?

    function my_event_calendar_month( $html, $args ) {
    
    	$month = (int) $args['month'];
    	$prev_month = ( $month == 1 ) ? 12 : $month - 1;
    	$next_month = ( $month == 12 ) ? 1 : $month + 1;
    
    	// prev
    	$html = preg_replace( '/(<button .*? class="month-prev".*?\>)(.*?)(<\/button>)/', '${1}' . "<{$prev_month}月" . '${3}', $html );
    
    	// next
    	$html = preg_replace( '/(<button .*? class="month-next".*?\>)(.*?)(<\/button>)/', '${1}' . "{$next_month}月>" . '${3}', $html );
    
    	return $html;
    }
    add_action( 'xo_event_calendar_month', 'my_event_calendar_month', 10, 2 );

    Reference page: https://xakuro.com/wordpress/xo-event-calendar/xo-event-calendar-month/

    Thread Starter wparijat

    (@wparijat)

    @ishitakaさん

    Thank You Very much it helped.

    Thank You for your quick response!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Next and Previous Text Change Hooks.’ is closed to new replies.