Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function rewrite_rule_by_date() {
- add_rewrite_rule('(by\-date)/(\[0-9]{4}-[0-9]{2}-[0-9]{2})$', 'index.php?pagename=$matches[1]&wpem_event_date=$matches[2]', 'top');
- }
- add_action( 'init', array( &$this, 'rewrite_rule_by_date' ) );
- function query_var_by_date( $vars ) {
- add_rewrite_tag( '%wpem_event_date%', '([0-9]{4}-[0-9]{2}-[0-9]{2})');
- }
- add_action( 'query_vars', array( &$this, 'query_var_by_date' ) );
- function flush_rules() {
- global $wp_rewrite;
- $wp_rewrite->flush_rules();
- }
- register_activation_hook( __FILE__, array( &$this, 'flush_rules' ) );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement