[ 'name' => __('AffGate Slots', 'affgate-slot-catalog'), 'singular_name' => __('AffGate Slot', 'affgate-slot-catalog'), 'menu_name' => __('AffGate Slots', 'affgate-slot-catalog'), 'all_items' => __('All Slots', 'affgate-slot-catalog'), 'edit_item' => __('Edit Slot', 'affgate-slot-catalog'), 'view_item' => __('View Slot', 'affgate-slot-catalog'), 'search_items' => __('Search Slots', 'affgate-slot-catalog'), ], 'public' => true, 'show_ui' => true, 'show_in_menu' => 'affgsc-settings', 'supports' => ['title', 'editor', 'excerpt', 'thumbnail', 'custom-fields'], 'has_archive' => false, 'show_in_rest' => true, 'rewrite' => ['slug' => affgsc_catalog_rewrite_base('catalog'), 'with_front' => false], ]); register_taxonomy(AFFGSC_TAX_PROVIDER, [AFFGSC_POST_TYPE], [ 'labels' => [ 'name' => __('Providers', 'affgate-slot-catalog'), 'singular_name' => __('Provider', 'affgate-slot-catalog'), ], 'hierarchical' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_rest' => true, 'show_in_menu' => 'affgsc-settings', 'public' => (string)($settings['public_provider_pages'] ?? '0') === '1', 'rewrite' => ['slug' => affgsc_catalog_rewrite_base('provider'), 'with_front' => false], ]); register_taxonomy(AFFGSC_TAX_TYPE, [AFFGSC_POST_TYPE], [ 'labels' => [ 'name' => __('Game Types', 'affgate-slot-catalog'), 'singular_name' => __('Game Type', 'affgate-slot-catalog'), ], 'hierarchical' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_rest' => true, 'show_in_menu' => 'affgsc-settings', 'public' => (string)($settings['public_type_pages'] ?? '0') === '1', 'rewrite' => ['slug' => affgsc_catalog_rewrite_base('type'), 'with_front' => false], ]); register_taxonomy(AFFGSC_TAX_THEME, [AFFGSC_POST_TYPE], [ 'labels' => [ 'name' => __('Game Themes', 'affgate-slot-catalog'), 'singular_name' => __('Game Theme', 'affgate-slot-catalog'), ], 'hierarchical' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_rest' => true, 'show_in_menu' => 'affgsc-settings', 'public' => (string)($settings['public_theme_pages'] ?? '0') === '1', 'rewrite' => ['slug' => affgsc_catalog_rewrite_base('theme'), 'with_front' => false], ]); register_taxonomy(AFFGSC_TAX_VOLATILITY, [AFFGSC_POST_TYPE], [ 'labels' => [ 'name' => __('Volatility', 'affgate-slot-catalog'), 'singular_name' => __('Volatility', 'affgate-slot-catalog'), ], 'hierarchical' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_rest' => true, 'show_in_menu' => 'affgsc-settings', 'public' => false, 'rewrite' => ['slug' => 'slot-volatility'], ]); } function affgsc_add_slot_meta_boxes(): void { add_meta_box( 'affgsc_slot_actions', __('Slot Catalog Actions', 'affgate-slot-catalog'), 'affgsc_render_slot_actions_meta_box', AFFGSC_POST_TYPE, 'side', 'default' ); } function affgsc_render_slot_actions_meta_box(WP_Post $post): void { wp_nonce_field('affgsc_save_slot_meta', 'affgsc_slot_meta_nonce'); $real_play_url = (string)get_post_meta($post->ID, 'affgsc_real_play_url', true); ?>

post_type !== 'page' || wp_is_post_revision($post_id) || wp_is_post_autosave($post_id)) return; $settings = affgsc_settings(); foreach (['catalog_page_id', 'provider_page_id', 'type_page_id', 'theme_page_id'] as $setting_key) { $selected_id = absint($settings[$setting_key] ?? 0); if ($selected_id <= 0) continue; if ($selected_id === $post_id || in_array($post_id, array_map('absint', get_post_ancestors($selected_id)), true)) { affgsc_register_content_types(); flush_rewrite_rules(false); return; } } }