Custom Taxonomies

We have a number of Custom Taxonomies created for all scenarios, these follow the following format.

<?php 
$singular_name = 'location';
$plural_name = 'locations';
$plural_label = 'Locations';
$labels = array(
	'name'              => _x( $plural_label . ' Category', 'taxonomy general name' ),
	'singular_name'     => _x( $plural_label . ' Category', 'taxonomy singular name' ),
	'search_items'      => __( 'Search ' . $plural_label . ' Categories' ),
	'all_items'         => __( 'All ' . $plural_label . ' Categories' ),
	'parent_item'       => __( 'Parent ' . $plural_label . ' Category' ),
	'parent_item_colon' => __( 'Parent ' . $plural_label . ' Category:' ),
	'edit_item'         => __( 'Edit ' . $plural_label . ' Category' ),
	'update_item'       => __( 'Update ' . $plural_label . ' Category' ),
	'add_new_item'      => __( 'Add New ' . $plural_label . ' Category' ),
	'new_item_name'     => __( 'New ' . $plural_label . ' Category Name' ),
	'menu_name'         => __( $plural_label . ' Category' ),
);
$args = array(
	'hierarchical'      => true,
	'labels'            => $labels,
	'show_ui'           => true,
	'show_in_rest'      => true,
	'show_admin_column' => true,
	'query_var'         => true,
	'rewrite'           => array( 'slug' => $plural_name . '-category' ),
);
register_taxonomy( $plural_name . '-category', array( $singular_name ), $args );
?>

These are simply included in the theme functions.php similar to the CPTs

<?php 
if ( ! function_exists( 'gomo_cpt_init' ) ) :
	function gomo_cpt_init() {
		if( get_field('remove_admin_scripts', 'options') == 0 ):
			require get_template_directory() . '/gomo-functions/admin.php';
		endif;
		require get_template_directory() . '/gomo-functions/custom-post-types/documentation.php' ;
		require get_template_directory() . '/gomo-functions/custom-post-types/components.php' ;
		require get_template_directory() . '/gomo-functions/custom-post-types/testimonials.php' ;
		require get_template_directory() . '/gomo-functions/custom-post-types/listings.php' ;
		require get_template_directory() . '/gomo-functions/custom-post-types/panel.php' ;
		require get_template_directory() . '/gomo-functions/custom-post-types/case-studies.php' ;
		require get_template_directory() . '/gomo-functions/acf/acf.php' ;
		require get_template_directory() . '/gomo-functions/custom-taxonomy/resources.php' ;
		require get_template_directory() . '/gomo-functions/custom-taxonomy/listings.php' ;
		require get_template_directory() . '/gomo-functions/custom-taxonomy/case-studies.php' ;
	}
endif;
add_action( 'init', 'gomo_cpt_init' ); 
?>

Search the site


Address

123 Main Street
Town
City
P05T C0D3

Tel: 01234 567 899

Mob: 01234 567 899

Email: ben@gomopress.com


Copyright 2023. Blah blah blah Company Limited