Last active
August 4, 2017 15:28
-
-
Save mdailey77/b03856736bef787043d20727d24adac8 to your computer and use it in GitHub Desktop.
Change Events Calendar single event permalinks when category is 'webinar'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// change webinar permalinks from http://www.site.com/events/event-name | |
// to http://www.site.com/webinars/event-name | |
add_filter( 'post_type_link', 'change_webinar_links', 10, 2 ); | |
function change_webinar_links( $link, $post) { | |
if ( $post->post_type == 'tribe_events' && tribe_event_in_category('webinar') ) { | |
$link = trailingslashit( home_url('/webinars/' . $post->post_name ) ); | |
} | |
return $link; | |
} | |
// rewrite rule for webinars | |
add_action( 'init', 'webinar_rewrite_rule', 5); | |
function webinar_rewrite_rule() { | |
add_rewrite_rule( '^webinars/([^/]+)', 'index.php?tribe_events=$matches[1]&post_type=tribe_events&name=$matches[1]', 'top' ); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment