This commit is contained in:
alorig
2025-11-22 14:34:28 +05:00
parent 029c66a0f1
commit 3b3be535d6
15 changed files with 3122 additions and 140 deletions

View File

@@ -158,6 +158,100 @@ function igny8_get_control_mode() {
return in_array($mode, array('mirror', 'hybrid'), true) ? $mode : 'mirror';
}
/**
* Get supported taxonomies for syncing
*
* @return array Key => label
*/
function igny8_get_supported_taxonomies() {
$taxonomies = array();
// Standard WordPress taxonomies
if (taxonomy_exists('category')) {
$taxonomies['category'] = __('Categories', 'igny8-bridge');
}
if (taxonomy_exists('post_tag')) {
$taxonomies['post_tag'] = __('Tags', 'igny8-bridge');
}
// WooCommerce taxonomies
if (taxonomy_exists('product_cat')) {
$taxonomies['product_cat'] = __('Product Categories', 'igny8-bridge');
}
if (taxonomy_exists('product_tag')) {
$taxonomies['product_tag'] = __('Product Tags', 'igny8-bridge');
}
if (taxonomy_exists('product_shipping_class')) {
$taxonomies['product_shipping_class'] = __('Product Shipping Classes', 'igny8-bridge');
}
// IGNY8 taxonomies (always include)
if (taxonomy_exists('igny8_sectors')) {
$taxonomies['igny8_sectors'] = __('IGNY8 Sectors', 'igny8-bridge');
}
if (taxonomy_exists('igny8_clusters')) {
$taxonomies['igny8_clusters'] = __('IGNY8 Clusters', 'igny8-bridge');
}
// Get custom taxonomies (public only)
$custom_taxonomies = get_taxonomies(array(
'public' => true,
'_builtin' => false
), 'objects');
foreach ($custom_taxonomies as $taxonomy) {
// Skip if already added above
if (isset($taxonomies[$taxonomy->name])) {
continue;
}
// Skip post formats and other system taxonomies
if (in_array($taxonomy->name, array('post_format', 'wp_theme', 'wp_template_part_area'), true)) {
continue;
}
$taxonomies[$taxonomy->name] = $taxonomy->label;
}
/**
* Filter the list of selectable taxonomies.
*
* @param array $taxonomies
*/
return apply_filters('igny8_supported_taxonomies', $taxonomies);
}
/**
* Get enabled taxonomies for syncing
*
* @return array
*/
function igny8_get_enabled_taxonomies() {
$saved = get_option('igny8_enabled_taxonomies');
if (is_array($saved) && !empty($saved)) {
return $saved;
}
// Default: enable common taxonomies
return array('category', 'post_tag', 'product_cat', 'igny8_sectors', 'igny8_clusters');
}
/**
* Check if a taxonomy is enabled for syncing
*
* @param string $taxonomy Taxonomy key
* @return bool
*/
function igny8_is_taxonomy_enabled($taxonomy) {
$taxonomies = igny8_get_enabled_taxonomies();
return in_array($taxonomy, $taxonomies, true);
}
/**
* Get available automation modules
*