| Server IP : 65.108.144.40 / Your IP : 216.73.217.165 Web Server : Apache/2.4.52 (Ubuntu) System : Linux ubuntu-8gb-hel1-1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64 User : dev ( 1000) PHP Version : 8.2.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/successkpi/wp-content/themes/successkpi/inc/classes/ |
Upload File : |
<?php
/**
* Base Class for Custom Taxonomies
* Follows OOP architecture for dynamic registration.
*/
class CustomTaxonomy
{
public static $taxonomy = '';
public static $nameSingular = '';
public static $namePlural = '';
public static $postTypes = array();
public static $hierarchical = true;
public function __construct()
{
add_action('init', array($this, 'register_taxonomy'));
}
public function register_taxonomy()
{
if (empty(static::$taxonomy) || empty(static::$postTypes)) return;
$labels = array(
'name' => static::$namePlural,
'singular_name' => static::$nameSingular,
'search_items' => 'Search ' . static::$namePlural,
'all_items' => 'All ' . static::$namePlural,
'parent_item' => 'Parent ' . static::$nameSingular,
'parent_item_colon' => 'Parent ' . static::$nameSingular . ':',
'edit_item' => 'Edit ' . static::$nameSingular,
'update_item' => 'Update ' . static::$nameSingular,
'add_new_item' => 'Add New ' . static::$nameSingular,
'new_item_name' => 'New ' . static::$nameSingular . ' Name',
'menu_name' => static::$namePlural,
);
$args = array(
'hierarchical' => static::$hierarchical,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array('slug' => static::$taxonomy),
'show_in_rest' => true,
);
register_taxonomy(static::$taxonomy, static::$postTypes, $args);
}
}