roryashfordbentley / Flexbones

Responsive Wordpress barebones theme
MIT License
8 stars 1 forks source link

Better, more verbose custom taxonomies #63

Closed roryashfordbentley closed 7 years ago

roryashfordbentley commented 8 years ago

Found an issue where custom taxonomies were using some default syntax but it can be fixed with the following arguments for the taxonomy

$args = array(
        'hierarchical'      => false,
        'labels'            => array(
            'name'              => $plural_name,
            'singular_name'     => $single_name,
            'menu_name'         => $plural_name,
            'all_items' => 'All ' . $plural_name,
            'edit_item' => 'Edit ' . $plural_name,
            'view_item' => 'View ' . $plural_name,
            'update_item' => 'Update ' . $single_name,
            'add_new_item' => 'Add new ' . $single_name,
            'new_item_name' => 'Add new ' . $single_name . ' name',
            'search_items' => 'Search ' . $plural_name,
            'popular_items' => 'Popular ' . $plural_name,
            'separate_items_with_commas' => 'Seperate ' . $plural_name . ' with commas',
            'add_or_remove_items' => 'Add or remove  ' . $plural_name,
            'choose_from_most_used' => 'Choose from most used ' . $plural_name,
            'not_found' => 'No ' . $plural_name . ' found.'
        ),
        'show_ui'           => true,
        'show_in_rest'      => true,
        'show_admin_column' => true,
        'rest_base'         => 'product_type',
    );
DrizzlyOwl commented 8 years ago

Shouldn't rest_base be a variable?

roryashfordbentley commented 8 years ago

@DrizzlyOwl yup... it sure should.

// other vars are alreadin the current file
$rest_base = 'product_type';
$args = array(
        'hierarchical'      => false,
        'labels'            => array(
            'name'              => $plural_name,
            'singular_name'     => $single_name,
            'menu_name'         => $plural_name,
            'all_items' => 'All ' . $plural_name,
            'edit_item' => 'Edit ' . $plural_name,
            'view_item' => 'View ' . $plural_name,
            'update_item' => 'Update ' . $single_name,
            'add_new_item' => 'Add new ' . $single_name,
            'new_item_name' => 'Add new ' . $single_name . ' name',
            'search_items' => 'Search ' . $plural_name,
            'popular_items' => 'Popular ' . $plural_name,
            'separate_items_with_commas' => 'Seperate ' . $plural_name . ' with commas',
            'add_or_remove_items' => 'Add or remove  ' . $plural_name,
            'choose_from_most_used' => 'Choose from most used ' . $plural_name,
            'not_found' => 'No ' . $plural_name . ' found.'
        ),
        'show_ui'           => true,
        'show_in_rest'      => true,
        'show_admin_column' => true,
        'rest_base'         => $rest_base,
    );
roryashfordbentley commented 7 years ago

Fixed in 846dcdc