Skip to content

Instantly share code, notes, and snippets.

@theeventscalendar
Forked from anonymous/custom-view-slugs.php
Last active March 28, 2016 17:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theeventscalendar/649342aa266abe9a9234 to your computer and use it in GitHub Desktop.
Save theeventscalendar/649342aa266abe9a9234 to your computer and use it in GitHub Desktop.
Changes the names of the slugs used for events calendar views
<?php
/**
* Modify the "bases" used to form event URLs for various views.
*
* @param array $bases
*
* @return array
*/
function rename_event_view_slugs( $bases ) {
if ( isset( $bases['month'] ) ) $bases['month'] = [ 'calendar', 'calendar' ];
if ( isset( $bases['list'] ) ) $bases['list'] = [ 'all-events', 'all-events' ];
if ( isset( $bases['photo'] ) ) $bases['photo'] = [ 'picture-board', 'picture-board' ];
return $bases;
}
/**
* Wire up our code used to modify event slugs in the rewrite rules.
*/
add_filter( 'tribe_events_rewrite_base_slugs', 'rename_event_view_slugs', 20 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment