Files
cultureat-bak/wp-content/themes/ccat/includes/taxonomies/project-category.php
Pascal Martineau d225837d7b
All checks were successful
WordPress deployment / deploy (push) Successful in 9s
feat: Initial plugins and theme
2025-08-27 10:46:59 -04:00

69 lines
3.2 KiB
PHP

<?php
// Register 'project-category' taxonomy
add_action( 'init', 'ccat_project_category_register_taxonomy' );
function ccat_project_category_register_taxonomy() {
register_taxonomy(
'project_category',
array( 'project' ),
array(
'labels' => array(
'name' => __( "Project categories", 'ccat' ),
'singular_name' => __( "Project category", 'ccat' ),
'search_items' => __( "Search project-categories", 'ccat' ),
'popular_items' => __( "Popular project-categories", 'ccat' ),
'all_items' => __( "All project-categories", 'ccat' ),
'parent_item' => __( "Parent project-category", 'ccat' ),
'parent_item_colon' => __( "Parent project-category:", 'ccat' ),
'edit_item' => __( "Edit project-category", 'ccat' ),
'update_item' => __( "Update project-category", 'ccat' ),
'view_item' => __( "View project-category", 'ccat' ),
'add_new_item' => __( "New project-category", 'ccat' ),
'new_item_name' => __( "New project-category", 'ccat' ),
'separate_items_with_commas' => __( "Separate project-categories with commas", 'ccat' ),
'add_or_remove_items' => __( "Add or remove project-categories", 'ccat' ),
'choose_from_most_used' => __( "Choose from the most used project-categories", 'ccat' ),
'not_found' => __( "No project-categories found.", 'ccat' ),
'no_terms' => __( "No project-categories", 'ccat' ),
'menu_name' => __( "Project categories", 'ccat' ),
'items_list_navigation' => __( "Project categories list navigation", 'ccat' ),
'items_list' => __( "Project categories list", 'ccat' ),
'most_used' => __( "Most used", 'ccat' ),
'back_to_items' => __( "&larr; Back to project-categories", 'ccat' ),
),
'public' => false,
'hierarchical' => false,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => false,
'show_admin_column' => true,
'rewrite' => false,
'query_var' => true,
'show_in_rest' => true,
'rest_base' => 'project_category',
'rest_controller_class' => 'WP_REST_Terms_Controller',
'meta_box_cb' => false,
'show_in_graphql' => true,
'graphql_single_name' => "ProjectCategory",
'graphql_plural_name' => "ProjectCategories",
'graphql_interfaces' => array( 'Node' ),
)
);
}
// Custom 'project-category' term updated messages
add_filter( 'term_updated_messages', 'ccat_project_category_term_updated_messages' );
function ccat_project_category_term_updated_messages( $messages ) {
$messages['project_category'] = array(
0 => '',
1 => __( "Project category added.", 'ccat' ),
2 => __( "Project category deleted.", 'ccat' ),
3 => __( "Project category updated.", 'ccat' ),
4 => __( "Project category not added.", 'ccat' ),
5 => __( "Project category not updated.", 'ccat' ),
6 => __( "Project categories deleted.", 'ccat' ),
);
return $messages;
}