/** * Constructor */ public function __construct() { $this->slug = WC_POS_Admin_Permalink::get_slug(); $this->regex = '^' . $this->slug . '/?$'; add_rewrite_tag('%pos%', '([^&]+)'); add_rewrite_rule($this->regex, 'index.php?pos=1', 'top'); add_filter('option_rewrite_rules', array($this, 'rewrite_rules'), 1); add_action('template_redirect', array($this, 'template_redirect'), 1); }
/** * Constructor */ public function __construct() { if (defined('DOING_AJAX') && DOING_AJAX) { add_action('wp_ajax_wc_pos_payload', array($this, 'payload')); return; } $this->slug = WC_POS_Admin_Permalink::get_slug(); $this->regex = '^' . $this->slug . '/?$'; add_rewrite_tag('%pos%', '([^&]+)'); add_rewrite_rule($this->regex, 'index.php?pos=1', 'top'); add_filter('option_rewrite_rules', array($this, 'rewrite_rules'), 1); add_action('template_redirect', array($this, 'template_redirect'), 1); }
/** * Construct the POS permalink * * @param string $page * * @return string|void */ function wc_pos_url($page = '') { $slug = WC_POS_Admin_Permalink::get_slug(); return home_url($slug . '/' . $page); }