Last active
September 23, 2018 17:22
-
-
Save Lewiscowles1986/1326f75d7572caa5b73dae45911e9263 to your computer and use it in GitHub Desktop.
WordPress media Taxonomies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: CODESIGN2 Media Taxonomy Modifications | |
Plugin URI: http://www.codesign2.co.uk | |
Description: We think it's a real shame that media can be a little unweildy, and not make much sense; on larger sites it's debilitating, so we made this plugin. Enjoy | |
Author: CODESIGN2 | |
Version: 1.3.6 | |
Author URI: http://www.codesign2.co.uk/ | |
*/ | |
add_action('init', 'cd2_attachment_taxonomy_mods'); | |
function cd2_attachment_taxonomy_mods() { | |
cd2_add_attachment_location_taxonomy(); | |
cd2_add_attachment_category_taxonomy(); | |
cd2_add_attachment_tag_taxonomy(); | |
} | |
function cd2_add_attachment_location_taxonomy() { | |
$args = array( | |
'labels' => array( | |
'name' => __('Locations','cd2'), | |
'menu_name' => __('Locations','cd2'), | |
'add_new_item' => __('Add New Location','cd2'), | |
'edit_item' => __('Edit Location','cd2'), | |
'update_item' => __('Update Location','cd2'), | |
'singular_name' => __('Location','cd2'), | |
'search_items' => __('Search Locations','cd2'), | |
'all_items' => __('Locations...','cd2'), | |
'parent_item' => __('Parent Location','cd2'), | |
'parent_item_colon' => __('Parent Location:','cd2'), | |
'new_item_name' => __('New Location Name','cd2'), | |
), | |
'hierarchical' => true, | |
'query_var' => true, | |
'show_ui' => true, | |
'rewrite' => true, | |
'show_admin_column' => true | |
); | |
register_taxonomy( 'attachment_location', 'attachment', $args ); | |
} | |
function cd2_add_attachment_category_taxonomy() { | |
$args = array( | |
'labels' => array( | |
'name' => __('Categories','cd2'), | |
'menu_name' => __('Categories','cd2'), | |
'add_new_item' => __('Add New Category','cd2'), | |
'edit_item' => __('Edit Category','cd2'), | |
'update_item' => __('Update Category','cd2'), | |
'singular_name' => __('Category','cd2'), | |
'search_items' => __('Search Categories','cd2'), | |
'all_items' => __('Categories...','cd2'), | |
'parent_item' => __('Parent Category','cd2'), | |
'parent_item_colon' => __('Parent Category:','cd2'), | |
'new_item_name' => __('New Category Name','cd2'), | |
), | |
'hierarchical' => true, | |
'show_ui' => true, | |
'query_var' => true, | |
'rewrite' => true, | |
'show_admin_column' => true, | |
); | |
register_taxonomy( 'attachment_category', 'attachment', $args ); | |
} | |
function cd2_add_attachment_tag_taxonomy() { | |
$args = array( | |
'labels' => array( | |
'name' => __('Tags','cd2'), | |
'menu_name' => __('Tags','cd2'), | |
'add_new_item' => __('Add New Tag','cd2'), | |
'edit_item' => __('Edit Tag','cd2'), | |
'update_item' => __('Update Tag','cd2'), | |
'singular_name' => __('Tag','cd2'), | |
'search_items' => __('Search Tags','cd2'), | |
'all_items' => __('Tags...','cd2'), | |
'parent_item' => __('Parent Tag','cd2'), | |
'parent_item_colon' => __('Parent Tag:','cd2'), | |
'new_item_name' => __('New Tag Name','cd2'), | |
), | |
'hierarchical' => false, | |
'show_ui' => true, | |
'query_var' => true, | |
'rewrite' => true, | |
'show_admin_column' => true, | |
); | |
register_taxonomy( 'attachment_tag', 'attachment', $args ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment