WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #14877, comment 11


Ignore:
Timestamp:
09/27/11 16:08:59 (3 years ago)
Author:
sanchothefat
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #14877, comment 11

    initial v1  
    1616 
    1717{{{ 
    18 register_taxonomy_type( $type, $meta_box, $editable = true, $terms ) { 
     18register_taxonomy_type( $type, $meta_box ) { 
    1919 
    2020    // add $type to valid taxonomy types 
     
    2222    // associate the meta box callback function with the $type 
    2323 
    24     // if $editable is false then don't show 'add new' links or main admin UI 
    25     // and rescind manage_terms capabilities 
    26  
    27     // if $terms is supplied these would be the default terms in the taxonomy 
    28     // $terms should be required when $editable is false 
    29  
    3024} 
    3125}}} 
    3226 
    33 So for post formats you'd have: 
     27So for the exclusive type you'd have: 
    3428 
    3529{{{ 
    3630register_taxonomy_type( 
    37     'post_format', 
    38     'post_formats_meta_box', 
    39     false, 
    40     array( 'gallery' => __( 'Gallery' ), 'video' => __( 'Video' ), ...etc... ) 
     31    'exclusive', 
     32    'exclusive_taxonomy_meta_box' 
    4133); 
    4234}}} 
     
    4638 
    4739This is probably what you had in mind already but wanted to get my ideas down in the appropriate place. 
     40 
     41 
     42'''Edit.''' 
     43You would need to extend register_taxonomy() to accept two more arguments: 
     44 
     45editable = boolean 
     46    // if $editable is false then don't show 'add new' links or main admin UI and rescind manage_terms capabilities 
     47 
     48terms = array 
     49    // if $terms is supplied these would be the default terms in the taxonomy. $terms should be required when $editable is false