Skip to content

Instantly share code, notes, and snippets.

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 cliffordp/8c1be9fe0569741cd50d25407b12cd37 to your computer and use it in GitHub Desktop.
Save cliffordp/8c1be9fe0569741cd50d25407b12cd37 to your computer and use it in GitHub Desktop.
Revision of custom event view slug snippet
<?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