/** * Install Documentate */ public static function install() { global $wpdb; self::create_option(); self::create_table(); // Register post types Docu_Post_Type::register_post_type(); Docu_Post_Type::register_category_taxonomy(); Docu_Post_Type::register_tag_taxonomy(); // Flush rules after install flush_rewrite_rules(); self::update_version(); // Trigger action do_action('documentate_installed'); }
$category_base = documentate_get_option('category_base'); $args = apply_filters('docu_cat_args', array('hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'query_var' => true, 'rewrite' => array('slug' => $category_base, 'with_front' => false, 'hierarchical' => true))); register_taxonomy('docu_cat', array('document'), $args); } /** * Register Custom Tags Taxonomy * @since 1.0.0 */ public static function register_tag_taxonomy() { $labels = array('name' => __('Document Tags', 'documentate'), 'singular_name' => __('Document Tag', 'documentate'), 'search_items' => __('Search Document Tags', 'documentate'), 'all_items' => __('All Document Tags', 'documentate'), 'edit_item' => __('Edit Document Tag', 'documentate'), 'update_item' => __('Update Document Tag', 'documentate'), 'add_new_item' => __('Add New Document Tag', 'documentate'), 'new_item_name' => __('New Document Tag Name', 'documentate'), 'menu_name' => __('Tags', 'documentate')); $tag_base = documentate_get_option('tag_base'); $args = apply_filters('docu_tag_args', array('hierarchical' => false, 'labels' => $labels, 'show_ui' => true, 'query_var' => true, 'rewrite' => array('slug' => $tag_base, 'with_front' => true))); register_taxonomy('docu_tag', array('document'), $args); } /** * WordPress uses exclude_from_search where it shouldn't * resulting in empty taxonomy archives! * see: https://core.trac.wordpress.org/ticket/17592 * @since 1.0.0 */ public static function fix_wp_tax_archives($q) { if (is_tax(array('docu_cat', 'docu_tag'))) { $q->set('post_type', 'document'); } } } } Docu_Post_Type::init();