Advertisement
Guest User

Untitled

a guest
Jan 25th, 2013
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. function rewrite_rule_by_date() {
  3.     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');
  4. }
  5. add_action( 'init', array( &$this, 'rewrite_rule_by_date' ) );
  6.  
  7. function query_var_by_date( $vars ) {
  8.     add_rewrite_tag( '%wpem_event_date%', '([0-9]{4}-[0-9]{2}-[0-9]{2})');
  9. }
  10. add_action( 'query_vars', array( &$this, 'query_var_by_date' ) );
  11.  
  12. function flush_rules() {
  13.     global $wp_rewrite;
  14.  
  15.     $wp_rewrite->flush_rules();
  16. }
  17. register_activation_hook( __FILE__, array( &$this, 'flush_rules' ) );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement