<?php /* Plugin Name: Riesma Setup Plugin URI: https://github.com/riesma/wordpress-setup-plugin Description: Adding custom post types, sorting and hiding admin menu items. Version: 1.1.2 Author: Richard van Aalst Author URI: http://riesma.nl/ Copyright (C) 2012-2014 Richard van Aalst This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ if (!defined('ABSPATH')) { exit; } // Initialise the setup require_once 'includes/class.main.php'; Riesma::init();
/** * Register taxonomy * */ public function register_taxonomy() { if (!empty($this->taxonomies)) { foreach ($this->taxonomies as $taxonomy) { // Predefined taxonomy if (!is_array($taxonomy)) { switch ($taxonomy) { // Categories (predefined): WordPress provides translation case 'cat': register_taxonomy($this->the_post_type . '_category', array($this->the_post_type), array('hierarchical' => true, 'rewrite' => array('slug' => $this->slug . '-' . Riesma::slugify(__('Categories')), 'with_front' => true))); break; // Tags (predefined): WordPress provides translation // Tags (predefined): WordPress provides translation case 'tag': register_taxonomy($this->the_post_type . '_tag', array($this->the_post_type), array('hierarchical' => false, 'rewrite' => array('slug' => $this->slug . '-' . Riesma::slugify(__('Tags')), 'with_front' => true))); break; // WordPress default post categories // WordPress default post categories case 'WP_cat': register_taxonomy_for_object_type('category', $this->the_post_type); break; // WordPress default post tags // WordPress default post tags case 'WP_tag': register_taxonomy_for_object_type('post_tag', $this->the_post_type); break; } } else { if (is_array($taxonomy)) { $the_taxonomy = $this->the_post_type . '_' . $taxonomy['taxonomy']; $tax_name = $this->the_post_type . '_' . $taxonomy['name']; $tax_plural = $taxonomy['plural']; $tax_singular = $taxonomy['singular']; $tax_hierarchical = !empty($taxonomy['hierarchical']) ? $taxonomy['hierarchical'] : true; $tax_slug = $this->slug . '-' . Riesma::slugify($tax_name); register_taxonomy($the_taxonomy, array($this->the_post_type), array('labels' => array('name' => __($tax_plural), 'singular_name' => __($tax_singular)), 'hierarchical' => $tax_hierarchical, 'public' => true, 'show_ui' => true, 'show_in_nav_menus' => true, 'show_admin_column' => true, 'query_var' => true, 'rewrite' => array('slug' => $tax_slug, 'with_front' => true))); } } } // end foreach taxonomy } }