Change text of view links in header bar

Home Forums Calendar Products Events Calendar PRO Change text of view links in header bar

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #937045
    Tony
    Participant

    How can I change the text of the view options in the header bar? For example, I want to change the options of “Month”, “List”, “Photo” to have different wording. It looks like the text is using a filter but I couldn’t find it in the docs.

    #937562
    Barry
    Member

    Hi Tony,

    That’s definitely possible, see this example (not very practical in itself, but it outlines the process):

    add_filter( 'tribe-events-bar-views', 'alter_view_names', 100 );
    
    function alter_view_names( array $views ) {
    	foreach ( $views as &$view )
    		$view['anchor'] = 'Custom name for ' . $view['anchor'];
    	
    	return $views;
    }

    Does that help?

    #937981
    Tony
    Participant

    Can I target a specific view? For example I want to change “Month” to say “Calendar” instead.

    #938115
    Barry
    Member

    You can, in place of this line:

    $view['anchor'] = 'Custom name for ' . $view['anchor'];

    Use:

    if ( 'Month' === $view['anchor'] ) $view['anchor'] = 'Calendar';

    You may need to tweak slightly to meet your needs.

    Good luck 🙂

    #938301
    Tony
    Participant

    Ah thanks!

    #938309
    Barry
    Member

    Pleasure!

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Change text of view links in header bar’ is closed to new replies.