public function register_tree_taxonomy() { /* * The Tree Shapes */ if (!taxonomy_exists('tree_shapes')) { $labels = array('name' => _tt('Shapes'), 'singular_name' => _tt('Shape'), 'menu_name' => _tt('Shapes'), 'all_items' => _tt('All Shapes'), 'parent_item' => _tt('Parent Shape'), 'parent_item_colon' => _tt('Parent Shape:'), 'new_item_name' => _tt('New Tree Shape'), 'add_new_item' => _tt('Add New Tree Shape'), 'edit_item' => _tt('Edit Shape'), 'update_item' => _tt('Update Shape'), 'separate_items_with_commas' => _tt('Separate Shapes with commas'), 'search_items' => _tt('Search Shapes'), 'add_or_remove_items' => _tt('Add or remove Shape'), 'choose_from_most_used' => _tt('Choose from the most used Shapes'), 'not_found' => _tt('Shape Not Found')); $args = array('labels' => $labels, 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_nav_menus' => true, 'show_tagcloud' => false); register_taxonomy('tree_shapes', 'tree_species', $args); } /* * The Flower Colors */ if (!taxonomy_exists('tree_flower_colors')) { $labels = array('name' => _tt('Flower Colors'), 'singular_name' => _tt('Flower Color'), 'menu_name' => _tt('Colors'), 'all_items' => _tt('All Flower Colors'), 'parent_item' => _tt('Parent Color'), 'parent_item_colon' => _tt('Parent Color:'), 'new_item_name' => _tt('New Flower Color'), 'add_new_item' => _tt('Add New Flower Color'), 'edit_item' => _tt('Edit Flower Color'), 'update_item' => _tt('Update Flower Color'), 'separate_items_with_commas' => _tt('Separate Flower Color with commas'), 'search_items' => _tt('Search Flower Color'), 'add_or_remove_items' => _tt('Add or remove Flower Color'), 'choose_from_most_used' => _tt('Choose from the most used colors'), 'not_found' => _tt('Color Not Found')); $args = array('labels' => $labels, 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_nav_menus' => true, 'show_tagcloud' => false); register_taxonomy('tree_flower_colors', 'tree_species', $args); } /* * The Flower Colors */ if (!taxonomy_exists('tree_category')) { $labels = array('name' => _tt('Tree Categories'), 'singular_name' => _tt('Tree Category'), 'menu_name' => _tt('Categories'), 'all_items' => _tt('All Tree Category'), 'parent_item' => _tt('Parent Tree Category'), 'parent_item_colon' => _tt('Parent Tree Category:'), 'new_item_name' => _tt('New Tree Category'), 'add_new_item' => _tt('Add New Tree Category'), 'edit_item' => _tt('Edit Tree Category'), 'update_item' => _tt('Update Tree Category'), 'separate_items_with_commas' => _tt('Separate Tree Category with commas'), 'search_items' => _tt('Search Tree Category'), 'add_or_remove_items' => _tt('Add or remove Tree Category'), 'choose_from_most_used' => _tt('Choose from the most used Tree Category'), 'not_found' => _tt('Category Not Found')); $args = array('labels' => $labels, 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_nav_menus' => true, 'show_tagcloud' => false); register_taxonomy('tree_category', 'tree_species', $args); } }
public function tree_species_cmb_register_metaboxes() { // Start with an underscore to hide fields from custom fields list $meta_field_prefix = '_tree_species_'; //region ----Identity --- /** * Identity Box */ $cmb_indentity = new_cmb2_box(array('id' => $meta_field_prefix . 'identity_box', 'title' => _tt('Identity'), 'object_types' => array('tree_species'), 'priority' => 'high')); $cmb_indentity->add_field(array('name' => _tt('Scientific Name'), 'desc' => _tt('Scientific name'), 'id' => $meta_field_prefix . 'scientific_name', 'type' => 'text_medium')); $cmb_indentity->add_field(array('name' => _tt('Family'), 'desc' => _tt('Tree Family'), 'id' => $meta_field_prefix . 'family', 'type' => 'text_medium')); $cmb_indentity->add_field(array('name' => _tt('Synonym'), 'desc' => _tt('A name synonym'), 'id' => $meta_field_prefix . 'synonym', 'type' => 'text_medium')); $cmb_indentity->add_field(array('name' => _tt('Common Name'), 'desc' => _tt('English Common name'), 'id' => $meta_field_prefix . 'common_name', 'type' => 'text_medium')); $cmb_indentity->add_field(array('name' => _tt('Origin'), 'desc' => _tt('The region or country this tree origins from'), 'id' => $meta_field_prefix . 'origin', 'type' => 'text_medium')); //endregion Secti //region ---Shape--- $cmb_shape = new_cmb2_box(array('id' => $meta_field_prefix . 'shape_box', 'title' => _tt('Shape'), 'object_types' => array('tree_species'), 'priority' => 'high')); $cmb_shape->add_field(array('name' => _tt('Shape and Size', 'tree-species'), 'desc' => _tt('Select the tree shape and height. You can a short text description.'), 'id' => $meta_field_prefix . 'shape_title', 'type' => 'title')); $cmb_shape->add_field(array('name' => _tt('Shape'), 'desc' => _tt('Tree Shape category'), 'id' => $meta_field_prefix . 'shape_tax', 'type' => 'taxonomy_radio', 'taxonomy' => 'tree_shapes', 'default' => '', 'inline' => true)); $cmb_shape->add_field(array('name' => _tt('Height'), 'desc' => _tt('Average height for this tree species. Small < '), 'id' => $meta_field_prefix . 'shape_height', 'type' => 'select', 'show_option_none' => false, 'default' => 'medium', 'options' => array('very_large' => _tt('Very Large'), 'large' => _tt('Large'), 'medium' => _tt('Medium'), 'small' => _tt('Small'), 'extra_small' => _tt('Extra Small')))); $cmb_shape->add_field(array('name' => _tt('Diameter'), 'desc' => _tt('The tree shade diameter'), 'id' => $meta_field_prefix . 'shape_diameter', 'type' => 'text_medium')); $cmb_shape->add_field(array('name' => _tt('Growth Rate'), 'desc' => _tt('Very slow < 0.3 M/Y, Slow = 0.3-0.6 M/Y, Medium = 1-0.6 M/Y, Fast = 1-2 M/Y, Very fast > 2 M/Y '), 'id' => $meta_field_prefix . 'shape_growth_rate', 'type' => 'select', 'show_option_none' => true, 'options' => array('very_fast' => _tt('Very Fast'), 'fast' => _tt('Fast'), 'medium' => _tt('Medium'), 'slow' => _tt('Slow'), 'very_slow' => _tt('Very Slow')))); //endregion //region ---Morphology--- /* * tree morphology boxes */ $cmb_morphology = new_cmb2_box(array('id' => $meta_field_prefix . 'morphology_box', 'title' => _tt('Morphology'), 'object_types' => array('tree_species'), 'priority' => 'high')); //------------------------------------ //flowers //------------------------------------ $cmb_morphology->add_field(array('name' => _tt('The Flowers', 'tree-species'), 'id' => $meta_field_prefix . 'flowers_title', 'type' => 'title')); $months = []; for ($m = 1; $m <= 12; $m++) { $month_name = date('F', mktime(0, 0, 0, $m)); array_push($months, $month_name); } $cmb_morphology->add_field(array('name' => _tt('Flowering Months'), 'desc' => _tt('Check the months this tree flowers in'), 'id' => $meta_field_prefix . 'flowering_months', 'type' => 'multicheck', 'default' => -1, 'options' => $months, 'inline' => true)); $cmb_morphology->add_field(array('name' => _tt('Flower Colors'), 'desc' => _tt('Select the flowers color - this will help locate trees by flowering color.'), 'id' => $meta_field_prefix . 'flower_colors', 'type' => 'taxonomy_radio', 'taxonomy' => 'tree_flower_colors', 'default' => '', 'inline' => true)); $cmb_morphology->add_field(array('name' => _tt('Flower Shape'), 'desc' => _tt('a short description of the flower shape, morphology, reproduction habit etc\''), 'id' => $meta_field_prefix . 'flower_shape', 'type' => 'text')); //------------------------------------ //Leaves //------------------------------------ $cmb_morphology->add_field(array('name' => _tt('The Leaves', 'tree-species'), 'id' => $meta_field_prefix . 'leaves_title_box', 'type' => 'title')); $cmb_morphology->add_field(array('name' => _tt('Order'), 'desc' => _tt('Leaf order'), 'id' => $meta_field_prefix . 'leaf_order', 'type' => 'text_medium')); $cmb_morphology->add_field(array('name' => _tt('Shape'), 'desc' => _tt('Leaf shape, type and edge structure'), 'id' => $meta_field_prefix . 'leaf_shape', 'type' => 'text_medium')); $cmb_morphology->add_field(array('name' => _tt('Deciduous'), 'desc' => _tt('Abscission - does the tree loses his leaves in winter'), 'id' => $meta_field_prefix . 'leaf_deciduous', 'type' => 'radio_inline', 'show_option_none' => 'No Selection', 'options' => array('evergreen' => _tt('Evergreen', 'tree-species'), 'semi-deciduous' => _tt('Semi-Deciduous', 'tree-species'), 'deciduous' => _tt('Deciduous', 'tree-species')))); $cmb_morphology->add_field(array('name' => _tt('Other Visual Properties', 'tree-species'), 'desc' => _tt('Describe other decorative organs or visual features this tree has'), 'id' => $meta_field_prefix . 'decorative_organ_title', 'type' => 'title')); $cmb_morphology->add_field(array('name' => _tt('Decorative Organs'), 'desc' => _tt('Other decorative organ the tree might have, type and edge structure'), 'id' => $meta_field_prefix . 'decorative_organs', 'type' => 'text')); //endregion //region ---Habitat--- /* * tree Habitat description box */ $cmb_habitat = new_cmb2_box(array('id' => $meta_field_prefix . 'habitat_box', 'title' => _tt('Habitat'), 'object_types' => array('tree_species'), 'priority' => 'high', 'show_names' => true)); $cmb_habitat->add_field(array('name' => _tt('Habitat'), 'desc' => _tt('Habitat'), 'id' => $meta_field_prefix . 'habitat_description', 'type' => 'text')); $cmb_habitat->add_field(array('name' => _tt('Range'), 'desc' => _tt('Range'), 'id' => $meta_field_prefix . 'habitat_range', 'type' => 'text')); $cmb_habitat->add_field(array('name' => _tt('Irrigation'), 'desc' => _tt('Water Hardiness and irrigation needs'), 'id' => $meta_field_prefix . 'habitat_irrigation', 'type' => 'text')); $cmb_habitat->add_field(array('name' => _tt('Soil'), 'desc' => _tt('Soil Requirement'), 'id' => $meta_field_prefix . 'habitat_soil', 'type' => 'text')); $cmb_habitat->add_field(array('name' => _tt('Sensitivity'), 'desc' => _tt('Special Sensitivity'), 'id' => $meta_field_prefix . 'habitat_sensitivity', 'type' => 'text')); $cmb_habitat->add_field(array('name' => _tt('Pests'), 'desc' => _tt('Pests this tree is sensitive to'), 'id' => $meta_field_prefix . 'habitat_pests', 'type' => 'text_medium')); //endregion //region ---Gardening Usage--- /* * tree behavior description box */ $cmb_description = new_cmb2_box(array('id' => $meta_field_prefix . 'gardening_usage_box', 'title' => _tt('Gardening Usage'), 'object_types' => array('tree_species'), 'priority' => 'high', 'show_names' => false)); $cmb_description->add_field(array('name' => _tt('Gardening Usage', 'tree-species'), 'desc' => _tt('A short description of this tree gardening usage and behavior', 'tree-species'), 'id' => $meta_field_prefix . 'gardening_usage', 'type' => 'wysiwyg', 'options' => array('textarea_rows' => 10))); //endregion //region ---Image Gallery-- /* * tree Image Gallery Flower, Leaf, Bark, Fruit */ $cmb_images = new_cmb2_box(array('id' => $meta_field_prefix . 'images_box', 'title' => _tt('Images'), 'object_types' => array('tree_species'), 'priority' => 'high')); $cmb_images->add_field(array('name' => _tt('Flower', 'tree-species'), 'desc' => _tt('Upload an image or enter a URL.', 'tree-species'), 'id' => $meta_field_prefix . 'flower_image', 'type' => 'file')); $cmb_images->add_field(array('name' => _tt('Fruit', 'tree-species'), 'desc' => _tt('Upload an image or enter a URL.', 'tree-species'), 'id' => $meta_field_prefix . 'fruit_image', 'type' => 'file')); $cmb_images->add_field(array('name' => _tt('Leaf', 'tree-species'), 'desc' => _tt('Upload an image or enter a URL.', 'tree-species'), 'id' => $meta_field_prefix . 'leaf_image', 'type' => 'file')); $cmb_images->add_field(array('name' => _tt('Bark', 'tree-species'), 'desc' => _tt('Upload an image or enter a URL.', 'tree-species'), 'id' => $meta_field_prefix . 'bark_image', 'type' => 'file', 'after_field' => '<p>The Featured Image will be used as the main tree image.</br> Please upload a full view image in the tree <strong>Featured Image Field</strong>.</p>')); //endregion //region ---References--- /* * More external references box */ $cmb_references = new_cmb2_box(array('id' => $meta_field_prefix . 'references_box', 'title' => _tt('References'), 'object_types' => array('tree_species'), 'priority' => 'high', 'show_names' => false)); $cmb_references->add_field(array('name' => _tt('External References', 'tree-species'), 'desc' => _tt('External references(website links, books, articles etc\')', 'tree-species'), 'id' => $meta_field_prefix . 'external_referneces', 'type' => 'wysiwyg', 'options' => array('textarea_rows' => 5))); //endregion }