HEX
Server: Apache
System: Linux web2213.uni5.net 5.4.282-1.el8.elrepo.x86_64 #1 SMP Mon Aug 19 18:33:22 EDT 2024 x86_64
User: clinicamaciel (596848)
PHP: 7.3.33
Disabled: apache_child_terminate,c99_buff_prepare,c99_sess_put,dl,eval,exec,leak,link,myshellexec,openlog,passthru,pclose,pcntl_exec,php_check_syntax,php_strip_whitespace,popen,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,symlink,system,socket_listen,socket_create_listen,putenv
Upload Files
File: /home/clinicamaciel/www/wp-content/plugins/trx_addons/cpt/cars/cars.taxonomy_features.php
<?php
/**
 * ThemeREX Addons Custom post type: Cars (Taxonomy 'Features' support)
 *
 * @package WordPress
 * @subpackage ThemeREX Addons
 * @since v1.6.25
 */

// Don't load directly
if ( ! defined( 'TRX_ADDONS_VERSION' ) ) {
	die( '-1' );
}


// -----------------------------------------------------------------
// -- Custom post type registration
// -----------------------------------------------------------------

// Define Custom post type and taxonomy constants for 'Cars'
if ( ! defined('TRX_ADDONS_CPT_CARS_TAXONOMY_FEATURES') )
		define('TRX_ADDONS_CPT_CARS_TAXONOMY_FEATURES', trx_addons_cpt_param('cars', 'taxonomy_features'));

// Register post type and taxonomy
if (!function_exists('trx_addons_cpt_cars_taxonomy_features_init')) {
	add_action( 'init', 'trx_addons_cpt_cars_taxonomy_features_init' );
	function trx_addons_cpt_cars_taxonomy_features_init() {
		
		register_taxonomy( TRX_ADDONS_CPT_CARS_TAXONOMY_FEATURES, TRX_ADDONS_CPT_CARS_PT, array(
			'post_type' 		=> TRX_ADDONS_CPT_CARS_PT,
			'hierarchical'      => true,
			'labels'            => array(
				'name'              => esc_html__( 'Features', 'trx_addons' ),
				'singular_name'     => esc_html__( 'Feature', 'trx_addons' ),
				'search_items'      => esc_html__( 'Search Features', 'trx_addons' ),
				'all_items'         => esc_html__( 'All Features', 'trx_addons' ),
				'parent_item'       => esc_html__( 'Parent Feature', 'trx_addons' ),
				'parent_item_colon' => esc_html__( 'Parent Feature:', 'trx_addons' ),
				'edit_item'         => esc_html__( 'Edit Feature', 'trx_addons' ),
				'update_item'       => esc_html__( 'Update Feature', 'trx_addons' ),
				'add_new_item'      => esc_html__( 'Add New Feature', 'trx_addons' ),
				'new_item_name'     => esc_html__( 'New Feature Name', 'trx_addons' ),
				'menu_name'         => esc_html__( 'Features', 'trx_addons' ),
			),
			'show_ui'           => true,
			'show_admin_column' => true,
			'query_var'         => true,
			'rewrite'           => array( 'slug' => trx_addons_cpt_param('cars', 'taxonomy_features_slug') )
			)
		);
	}
}


// Replace standard theme templates
//-------------------------------------------------------------

// Change standard category template for cars categories (groups)
if ( !function_exists( 'trx_addons_cpt_cars_taxonomy_features_taxonomy_template' ) ) {
	add_filter('taxonomy_template',	'trx_addons_cpt_cars_taxonomy_features_taxonomy_template');
	function trx_addons_cpt_cars_taxonomy_features_taxonomy_template( $template ) {
		if ( is_tax(TRX_ADDONS_CPT_CARS_TAXONOMY_FEATURES) ) {
			if (($template = trx_addons_get_file_dir('cpt/cars/tpl.cars.archive_features.php')) == '') 
				$template = trx_addons_get_file_dir('cpt/cars/tpl.cars.archive.php');
		}
		return $template;
	}	
}



// Admin utils
// -----------------------------------------------------------------

// Show <select> with cars categories in the admin filters area
if (!function_exists('trx_addons_cpt_cars_taxonomy_features_admin_filters')) {
	add_action( 'restrict_manage_posts', 'trx_addons_cpt_cars_taxonomy_features_admin_filters' );
	function trx_addons_cpt_cars_taxonomy_features_admin_filters() {
		trx_addons_admin_filters(TRX_ADDONS_CPT_CARS_PT, TRX_ADDONS_CPT_CARS_TAXONOMY_FEATURES);
	}
}
  
// Clear terms cache on the taxonomy 'features' save
if (!function_exists('trx_addons_cpt_cars_admin_clear_cache_features')) {
	add_action( 'edited_'.TRX_ADDONS_CPT_CARS_TAXONOMY_FEATURES, 'trx_addons_cpt_cars_admin_clear_cache_features', 10, 1 );
	add_action( 'delete_'.TRX_ADDONS_CPT_CARS_TAXONOMY_FEATURES, 'trx_addons_cpt_cars_admin_clear_cache_features', 10, 1 );
	add_action( 'created_'.TRX_ADDONS_CPT_CARS_TAXONOMY_FEATURES, 'trx_addons_cpt_cars_admin_clear_cache_features', 10, 1 );
	function trx_addons_cpt_cars_admin_clear_cache_features( $term_id=0 ) {  
		trx_addons_admin_clear_cache_terms(TRX_ADDONS_CPT_CARS_TAXONOMY_FEATURES);
	}
}
?>