• I really don’t like the double arrows for the next or previous month on the WordPress calendar widget. How do you change them or remove them completely?

    Regards.

Viewing 5 replies - 1 through 5 (of 5 total)
  • It is coded into the widget so I’m not sure that there is a way. If there is, I don’t see a way that won’t require code – either a hook or a hacky CSS solution.

    the calendar widget output (actually the output of the calendar function, regardless where it is used) is run over a filter 'get_calendar'
    (see /wp-includes/general-template.php line 1983)

    try to add a corresponding filter function into functions.php of your (child) theme;

    example for changing the double-arrows:

    add_filter( 'get_calendar', 'modify_default_calendar_widget_output' );
    
    function modify_default_calendar_widget_output( $output ) {
    	$output = str_replace( '?', 'NEWPREV', $output );
    	$output = str_replace( '?', 'NEWNEXT', $output );
    	return $output;
    }

    to remove them, use:

    add_filter( 'get_calendar', 'modify_default_calendar_widget_output' );
    
    function modify_default_calendar_widget_output( $output ) {
    	$output = str_replace( '?', '', $output );
    	$output = str_replace( '?', '', $output );
    	return $output;
    }
    Thread Starter Kev5

    (@kev5)

    Hi Michael,

    Thank you for the response. I tried adding the code you mentioned, but sadly it didn’t change anything regarding the calendar.

    I missing something or did I do something wrong?

    Regards.

    I just noticed that the forum editor converted the & laquo; and & raquo; into the double arrows.
    unfortunately, this won’t work.

    in the code, replace the left-double-arrow with & laquo; and the right-double-arrow with & raquo; (no space after the &)

    tested in a child theme of Twenty Sixteen – however, this is no guarantee that it works in all themes.

    Thread Starter Kev5

    (@kev5)

    It worked! Thank you, Micheal.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to change arrows on the WordPress calendar widget?’ is closed to new replies.