function init() { global $wp, $wp_rewrite; parent::init(); //Listing author rewrite rule $wp->add_query_var('dr_author_name'); $wp->add_query_var('dr_author_page'); $result = add_query_arg(array('dr_author_name' => '$matches[1]', 'dr_author_page' => '$matches[3]'), 'index.php'); add_rewrite_rule('dr-author/(.+?)(/page/(.+?))?/?$', $result, 'top'); $rules = get_option('rewrite_rules'); if (!isset($rules['dr-author/(.+?)(/page/(.+?))?/?$'])) { $wp_rewrite->flush_rules(); } }
function init() { global $wp, $wp_rewrite; parent::init(); //Inheritance /* Set BuddyPress active state */ $this->bp_active = true; /* Add navigation */ add_action('wp', array(&$this, 'add_navigation'), 2); /* Add navigation */ add_action('admin_menu', array(&$this, 'add_navigation'), 2); /* Enqueue styles */ add_action('wp_enqueue_scripts', array(&$this, 'enqueue_scripts')); add_action('wp_print_scripts', array(&$this, 'on_print_scripts')); add_action('wp_head', array(&$this, 'print_scripts')); add_action('bp_template_content', array(&$this, 'process_page_requests')); /* template for page */ //add_action( 'template_redirect', array( &$this, 'handle_nav' ) ); add_action('template_redirect', array(&$this, 'handle_page_requests')); }