// ========================================================================= // 1. REGISTER CUSTOM POST TYPES (GAMES & PROMOTIONS) // ========================================================================= add_action('init', function() { register_post_type('game', [ 'labels' => [ 'name' => 'Games', 'singular_name' => 'Game', 'add_new_item' => 'Add New Game', 'edit_item' => 'Edit Game', ], 'public' => true, 'has_archive' => true, 'supports' => ['title', 'editor', 'thumbnail', 'custom-fields'], 'menu_icon' => 'dashicons-controls-play', 'show_in_graphql' => true, 'graphql_single_name'=> 'game', 'graphql_plural_name'=> 'games', ]); register_post_type('promotion', [ 'labels' => [ 'name' => 'Promotions', 'singular_name' => 'Promotion', 'add_new_item' => 'Add New Promotion', 'edit_item' => 'Edit Promotion', ], 'public' => true, 'has_archive' => true, 'supports' => ['title', 'editor', 'thumbnail', 'custom-fields'], 'menu_icon' => 'dashicons-tickets-alt', 'show_in_graphql' => true, 'graphql_single_name'=> 'promotion', 'graphql_plural_name'=> 'promotions', ]); }); // ========================================================================= // 2. REGISTER ACF OPTIONS PAGES // ========================================================================= add_action('acf/init', function() { if (function_exists('acf_add_options_page')) { acf_add_options_page([ 'page_title' => 'PrimoGaming Settings', 'menu_title' => 'Primo Settings', 'menu_slug' => 'primogaming-settings', 'capability' => 'edit_posts', 'redirect' => false, 'icon_url' => 'dashicons-games', 'show_in_graphql' => true, ]); acf_add_options_sub_page([ 'page_title' => 'Hero Banners & Carousels', 'menu_title' => 'Banners', 'parent_slug' => 'primogaming-settings', 'menu_slug' => 'acf-options-banners', 'show_in_graphql' => true, ]); acf_add_options_sub_page([ 'page_title' => 'Game Providers', 'menu_title' => 'Game Providers', 'parent_slug' => 'primogaming-settings', 'menu_slug' => 'acf-options-game-providers', 'show_in_graphql' => true, ]); } }); // ========================================================================= // 3. IN-CODE ACF FIELD GROUPS (NO JSON IMPORT NEEDED) // ========================================================================= add_action('acf/init', function() { if (!function_exists('acf_add_local_field_group')) return; // Site Branding Group acf_add_local_field_group([ 'key' => 'group_primogaming_branding', 'title' => 'PrimoGaming Site Branding & Media', 'fields' => [ ['key' => 'field_brand_logo', 'label' => 'Primary Logo (GIF)', 'name' => 'brand_logo', 'type' => 'image', 'return_format' => 'array', 'show_in_graphql' => 1], ['key' => 'field_brand_mobile_logo', 'label' => 'Mobile Logo', 'name' => 'brand_mobile_logo', 'type' => 'image', 'return_format' => 'array', 'show_in_graphql' => 1], ['key' => 'field_global_play_now_url', 'label' => 'Global Affiliate URL', 'name' => 'global_play_now_url', 'type' => 'url', 'default_value' => 'https://www.primogaming1.vip/register?affiliateCode=mktgseo', 'show_in_graphql' => 1], ], 'location' => [[['param' => 'options_page', 'operator' => '==', 'value' => 'primogaming-settings']]], 'show_in_graphql' => 1, 'graphql_field_name' => 'siteBranding', ]); // Hero Banners Group acf_add_local_field_group([ 'key' => 'group_primogaming_banners', 'title' => 'Hero Banners & Campaign Carousels', 'fields' => [ [ 'key' => 'field_hero_banners', 'label' => 'Hero Banners', 'name' => 'hero_banners', 'type' => 'repeater', 'button_label' => 'Add Banner', 'show_in_graphql' => 1, 'sub_fields' => [ ['key' => 'field_banner_title', 'label' => 'Title', 'name' => 'title', 'type' => 'text', 'show_in_graphql' => 1], ['key' => 'field_banner_subtitle', 'label' => 'Subtitle', 'name' => 'subtitle', 'type' => 'textarea', 'rows' => 2, 'show_in_graphql' => 1], ['key' => 'field_banner_tag', 'label' => 'Tag', 'name' => 'tag', 'type' => 'text', 'default_value' => 'PROMOTION', 'show_in_graphql' => 1], ['key' => 'field_banner_cta_text', 'label' => 'CTA Text', 'name' => 'cta_text', 'type' => 'text', 'default_value' => 'PLAY NOW', 'show_in_graphql' => 1], ['key' => 'field_banner_cta_url', 'label' => 'CTA URL', 'name' => 'cta_url', 'type' => 'text', 'default_value' => '/play-now', 'show_in_graphql' => 1], ['key' => 'field_banner_desktop_image', 'label' => 'Desktop Image', 'name' => 'desktop_image', 'type' => 'image', 'return_format' => 'array', 'show_in_graphql' => 1], ['key' => 'field_banner_mobile_image', 'label' => 'Mobile Image', 'name' => 'mobile_image', 'type' => 'image', 'return_format' => 'array', 'show_in_graphql' => 1], ], ], ], 'location' => [[['param' => 'options_page', 'operator' => '==', 'value' => 'acf-options-banners']]], 'show_in_graphql' => 1, 'graphql_field_name' => 'bannerSettings', ]); // Game Providers Group acf_add_local_field_group([ 'key' => 'group_primogaming_providers', 'title' => 'Licensed Game Studios & Providers', 'fields' => [ [ 'key' => 'field_providers_list', 'label' => 'Provider Logos', 'name' => 'providers_list', 'type' => 'repeater', 'button_label' => 'Add Provider', 'show_in_graphql' => 1, 'sub_fields' => [ ['key' => 'field_provider_name', 'label' => 'Provider Name', 'name' => 'provider_name', 'type' => 'text', 'show_in_graphql' => 1], ['key' => 'field_provider_slug', 'label' => 'Slug', 'name' => 'provider_slug', 'type' => 'text', 'show_in_graphql' => 1], ['key' => 'field_provider_logo', 'label' => 'Logo Image', 'name' => 'provider_logo', 'type' => 'image', 'return_format' => 'array', 'show_in_graphql' => 1], ['key' => 'field_provider_games_count', 'label' => 'Games Count', 'name' => 'games_count', 'type' => 'number', 'default_value' => 100, 'show_in_graphql' => 1], ], ], ], 'location' => [[['param' => 'options_page', 'operator' => '==', 'value' => 'acf-options-game-providers']]], 'show_in_graphql' => 1, 'graphql_field_name' => 'providerSettings', ]); // Games Metadata Group acf_add_local_field_group([ 'key' => 'group_primogaming_games', 'title' => 'Game Settings & Metadata', 'fields' => [ ['key' => 'field_game_category', 'label' => 'Category', 'name' => 'category', 'type' => 'select', 'choices' => ['slots' => 'Slots', 'live-games' => 'Live Games', 'roulette' => 'Roulette', 'bingo' => 'Bingo & Arcade', 'fish' => 'Fish Shooting', 'sports' => 'Sportsbook'], 'default_value' => 'slots', 'show_in_graphql' => 1], ['key' => 'field_game_provider', 'label' => 'Provider', 'name' => 'provider', 'type' => 'text', 'default_value' => 'Pragmatic Play', 'show_in_graphql' => 1], ['key' => 'field_game_rtp', 'label' => 'RTP Percentage', 'name' => 'rtp', 'type' => 'number', 'step' => '0.01', 'default_value' => 96.5, 'show_in_graphql' => 1], ['key' => 'field_game_volatility', 'label' => 'Volatility', 'name' => 'volatility', 'type' => 'select', 'choices' => ['Low' => 'Low', 'Medium' => 'Medium', 'High' => 'High', 'Extreme' => 'Extreme'], 'default_value' => 'High', 'show_in_graphql' => 1], ['key' => 'field_game_is_hot', 'label' => 'Hot Badge', 'name' => 'is_hot', 'type' => 'true_false', 'show_in_graphql' => 1], ['key' => 'field_game_is_maxwin', 'label' => 'Maxwin Badge', 'name' => 'is_maxwin', 'type' => 'true_false', 'show_in_graphql' => 1], ['key' => 'field_game_custom_thumbnail', 'label' => 'Thumbnail', 'name' => 'custom_thumbnail', 'type' => 'image', 'return_format' => 'array', 'show_in_graphql' => 1], ], 'location' => [[['param' => 'post_type', 'operator' => '==', 'value' => 'game']]], 'show_in_graphql' => 1, 'graphql_field_name' => 'gameDetails', ]); // Promotions Metadata Group acf_add_local_field_group([ 'key' => 'group_primogaming_promotions', 'title' => 'Promotion Metadata', 'fields' => [ ['key' => 'field_promo_code', 'label' => 'Promo Code', 'name' => 'code', 'type' => 'text', 'show_in_graphql' => 1], ['key' => 'field_promo_bonus_amount', 'label' => 'Bonus Amount', 'name' => 'bonus_amount', 'type' => 'text', 'show_in_graphql' => 1], ['key' => 'field_promo_turnover', 'label' => 'Turnover Requirement', 'name' => 'turnover_requirement', 'type' => 'text', 'show_in_graphql' => 1], ['key' => 'field_promo_badge', 'label' => 'Badge Tag', 'name' => 'badge', 'type' => 'text', 'show_in_graphql' => 1], ['key' => 'field_promo_image', 'label' => 'Promo Graphic', 'name' => 'promo_image', 'type' => 'image', 'return_format' => 'array', 'show_in_graphql' => 1], ], 'location' => [[['param' => 'post_type', 'operator' => '==', 'value' => 'promotion']]], 'show_in_graphql' => 1, 'graphql_field_name' => 'promotionFields', ]); }); // ========================================================================= // 4. RANK MATH SEO TO WPGRAPHQL BRIDGE (NO EXTRA PLUGIN NEEDED) // ========================================================================= add_action('graphql_register_types', function() { register_graphql_object_type('PostSeoMetadata', [ 'description' => 'Rank Math SEO Metadata', 'fields' => [ 'title' => ['type' => 'String', 'description' => 'SEO Title'], 'metaDesc' => ['type' => 'String', 'description' => 'Meta Description'], 'canonical' => ['type' => 'String', 'description' => 'Canonical URL'], ], ]); $post_types = ['Post', 'Page', 'Game', 'Promotion']; foreach ($post_types as $type) { register_graphql_field($type, 'seo', [ 'type' => 'PostSeoMetadata', 'description' => 'Rank Math SEO output for ' . $type, 'resolve' => function($post) { $post_id = is_object($post) ? ($post->ID ?? $post->databaseId ?? 0) : 0; if (!$post_id) return null; $title = get_post_meta($post_id, 'rank_math_title', true) ?: get_the_title($post_id); $desc = get_post_meta($post_id, 'rank_math_description', true) ?: wp_strip_all_tags(get_post_field('post_excerpt', $post_id)); $canonical = get_post_meta($post_id, 'rank_math_canonical_url', true) ?: get_permalink($post_id); return ['title' => $title, 'metaDesc' => $desc, 'canonical' => $canonical]; }, ]); } }); // ========================================================================= // 5. ON-DEMAND TAGGED ISR REVALIDATION WEBHOOK // ========================================================================= add_action('save_post', function($post_id, $post, $update) { if (wp_is_post_revision($post_id) || wp_is_post_autosave($post_id)) return; $nextjs_url = defined('NEXTJS_REVALIDATE_URL') ? NEXTJS_REVALIDATE_URL : 'https://primomaxwin.com/api/revalidate'; $secret = defined('NEXTJS_REVALIDATE_SECRET') ? NEXTJS_REVALIDATE_SECRET : 'generate-cryptographically-secure-token'; $tags = ['site-assets', 'banners', 'games', 'promotions', 'posts']; foreach ($tags as $tag) { wp_remote_post(add_query_arg(['secret' => $secret, 'tag' => $tag], $nextjs_url), [ 'blocking' => false, 'timeout' => 3, ]); } }, 20, 3); https://cms.primomaxwin.com/post-sitemap.xml 2026-10-28T06:15:16+00:00 https://cms.primomaxwin.com/category-sitemap.xml 2026-10-28T06:15:16+00:00