Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Adjust the rewrite rules for News & Events
- *
- * Adds a simple "status" query variable to the News post type archive
- * to allow filtering the archive by a post meta field for event_date.
- * Allowed statuses are: upcoming, past, and posts (for non-event entries).
- * Also allows paging within the status filters.
- *
- * @since 1.0.0
- */
- public function register_event_rewrite_rules() {
- add_rewrite_tag( '%status%', '([^&]+)' );
- add_rewrite_rule( '^news/(upcoming|past|posts)/?$', 'index.php?post_type=news&status=$matches[1]', 'top' );
- add_rewrite_rule( '^news/(upcoming|past|posts)/page/?([0-9]{1,})/?$', 'index.php?paged=$matches[2]&post_type=news&status=$matches[1]', 'top' );
- add_rewrite_rule( '^news/status/(upcoming|past|posts)/?$', 'index.php?post_type=news&status=$matches[1]', 'top' );
- add_rewrite_rule( '^news/status/(upcoming|past|posts)/page/?([0-9]{1,})/?$', 'index.php?paged=$matches[2]&post_type=news&status=$matches[1]', 'top' );
- }
Advertisement
Add Comment
Please, Sign In to add comment