getSlug(); add_rewrite_rule( '^'.$slug.'/([a-zA-Z0-9]+)?', 'index.php?affiliate_redirect=$matches[1]', 'top' ); flush_rewrite_rules(); } /** * Options * Create admin menu options */ public function Options() { global $ymas; $ymas->admin_settings_tab->createOption( array( 'name' => $this->name, 'type' => 'heading', )); $ymas->admin_settings_tab->createOption( array( 'name' => __('Enable Shortlinks', 'ymas'), 'id' => $this->slug . '_enabled_shortlinks', 'type' => 'checkbox', 'default' => true, 'desc' => __('Check this box to enable shortlinks', 'ymas'), )); $ymas->admin_settings_tab->createOption( array( 'name' => __('Permalink (slug)', 'ymas'), 'id' => 'affiliate_shortlink_slug', 'type' => 'text', 'default' => 'out', 'desc' => __('Change to a custom URL slug for your affiliate links.
The structure is:', 'ymas') . ' ' . site_url() . '/<slug>/', )); $ymas->admin_settings_tab->createOption( array( 'type' => 'save', )); } /** * Get slug * Get saved shortlink slug */ public function getSlug() { global $ymas; $slug = $ymas->titan->getOption('affiliate_shortlink_slug'); if (isset($slug) AND !empty($slug)) $ymas->slug = $ymas->titan->getOption('affiliate_shortlink_slug'); else $ymas->slug = 'out'; return $ymas->slug; } }