function __construct() { parent::__construct(); if (PNE_Settings::auto_archive($this->slug)) { $this->new_rules(); add_filter('rewrite_rules_array', array($this, 'insert_rewrite_rules')); add_filter('query_vars', array($this, 'insert_query_vars')); add_action('wp_loaded', array($this, 'flush_rules')); } add_filter('posts_join', array($this, 'posts_join')); add_filter('posts_where', array($this, 'posts_where')); add_filter('posts_orderby', array($this, 'posts_orderby')); add_filter('post_limits', array($this, 'post_limits')); }
function register() { register_post_type($this->slug, array_merge(array('labels' => $this->labels ? $this->labels : array(), 'public' => $this->public, 'show_ui' => $this->show_ui, 'menu_position' => $this->menu_position, 'menu_icon' => $this->menu_icon ? plugins_url("/icons/{$this->menu_icon}.png", __FILE__) : null, 'capability_type' => 'post', 'hierarchical' => $this->hierarchical, 'supports' => $this->supports, 'has_archive' => PNE_Settings::auto_archive($this->slug) ? $this->archive_slug : false, 'rewrite' => array('slug' => $this->archive_slug, 'with_front' => false)))); }