Example #1
0
        register_taxonomy_for_object_type(mpp_get_type_taxname(), $gallery_post_type);
        register_taxonomy_for_object_type(mpp_get_component_taxname(), $gallery_post_type);
        register_taxonomy_for_object_type(mpp_get_status_taxname(), $gallery_post_type);
        $media_post_type = mpp_get_media_post_type();
        //associate taxonomies to media
        register_taxonomy_for_object_type(mpp_get_type_taxname(), $media_post_type);
        register_taxonomy_for_object_type(mpp_get_component_taxname(), $media_post_type);
        register_taxonomy_for_object_type(mpp_get_status_taxname(), $media_post_type);
    }
    private function register_taxonomy($taxonomy, $args)
    {
        extract($args);
        if (empty($taxonomy)) {
            return false;
        }
        $labels = self::_get_tax_labels($label, $labels);
        if (empty($slug)) {
            $slug = $taxonomy;
        }
        register_taxonomy($taxonomy, false, array('hierarchical' => $hierarchical, 'labels' => $labels, 'public' => true, 'show_in_menu' => false, 'show_in_nav_menus' => false, 'show_ui' => false, 'show_tagcloud' => true, 'capabilities' => array('manage_terms' => 'manage_categories', 'edit_terms' => 'manage_categories', 'delete_terms' => 'manage_categories', 'assign_terms' => 'read'), 'update_count_callback' => '_update_post_term_count', 'query_var' => true, 'rewrite' => array('with_front' => true, 'hierarchical' => $hierarchical)));
        mediapress()->taxonomies[$taxonomy] = $args;
    }
    //label builder for easy use
    public function _get_tax_labels($singular_name, $plural_name)
    {
        $labels = array('name' => $plural_name, 'singular_name' => $singular_name, 'search_items' => sprintf(__('Search %s', 'mediapress'), $plural_name), 'popular_items' => sprintf(__('Popular %s', 'mediapress'), $plural_name), 'all_items' => sprintf(__('All %s', 'mediapress'), $plural_name), 'parent_item' => sprintf(__('Parent %s', 'mediapress'), $singular_name), 'parent_item_colon' => sprintf(__('Parent %s:', 'mediapress'), $singular_name), 'edit_item' => sprintf(__('Edit %s', 'mediapress'), $singular_name), 'update_item' => sprintf(__('Update %s', 'mediapress'), $singular_name), 'add_new_item' => sprintf(__('Add New %s', 'mediapress'), $singular_name), 'new_item_name' => sprintf(__('New %s Name', 'mediapress'), $singular_name), 'separate_items_with_commas' => sprintf(__('Separate %s with commas', 'mediapress'), $plural_name), 'add_or_remove_items' => sprintf(__('Add or Remove %s', 'mediapress'), $plural_name), 'choose_from_most_used' => sprintf(__('Choose from the most used %s', 'mediapress'), $plural_name));
        return $labels;
    }
}
MPP_Post_Type_Helper::get_instance();
Example #2
0
 /**
  * Does initial setup on activation of the plugin
  */
 public function do_activation()
 {
     require_once $this->plugin_path . 'admin/mpp-admin-install.php';
     mpp_upgrade_legacy_1_0_b1_activity();
     //post type
     require_once $this->plugin_path . 'core/common/mpp-common-functions.php';
     require_once $this->plugin_path . 'core/mpp-post-type.php';
     //store default settings if not already exists
     add_option('mpp-settings', mpp_get_all_options());
     //initialize post type( because we want to flush the rewrite rules)
     MPP_Post_Type_Helper::get_instance()->init();
     //rewrite end points
     add_rewrite_endpoint('manage', EP_PERMALINK);
     add_rewrite_endpoint('media', EP_PERMALINK);
     flush_rewrite_rules();
     //multiple terms creation by WordPress is too much db intensive, let us do it lightly
     mpp_install_terms();
     //on activation, create logger table
     mpp_install_db();
 }
Example #3
0
 public function do_activation()
 {
     require_once $this->plugin_path . 'admin/mpp-admin-install.php';
     mpp_upgrade_legacy_1_0_b1_activity();
     //post type
     require_once $this->plugin_path . 'core/common/mpp-common-functions.php';
     require_once $this->plugin_path . 'core/mpp-post-type.php';
     add_option('mpp-settings', mpp_get_all_options());
     MPP_Post_Type_Helper::get_instance()->init();
     //rewrite end points
     add_rewrite_endpoint('manage', EP_PERMALINK);
     add_rewrite_endpoint('media', EP_PERMALINK);
     flush_rewrite_rules();
     //on activation, create logger table
     mpp_install_terms();
     mpp_install_db();
 }