/** * Coponix Premium functions and definitions */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Theme Setup */ function coponix_setup() { // Add support for title tag add_theme_support( 'title-tag' ); // Add support for post thumbnails add_theme_support( 'post-thumbnails' ); // Register navigation menus register_nav_menus( array( 'primary' => __( 'Primary Menu', 'coponix' ), 'footer' => __( 'Footer Menu', 'coponix' ), ) ); // Switch default core markup for search form, comment form, and comments to output valid HTML5. add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', ) ); } add_action( 'after_setup_theme', 'coponix_setup' ); /** * Enqueue scripts and styles */ function coponix_scripts() { // Main Stylesheet wp_enqueue_style( 'coponix-style', get_stylesheet_uri(), array(), '1.0.0' ); // Custom Main CSS wp_enqueue_style( 'coponix-main', get_template_directory_uri() . '/assets/css/main.css', array(), '1.0.0' ); // Custom Main JS wp_enqueue_script( 'coponix-app', get_template_directory_uri() . '/assets/js/app.js', array(), '1.0.0', true ); // Localize script for AJAX (if needed later) wp_localize_script( 'coponix-app', 'coponix_data', array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'coponix_nonce' ), ) ); } add_action( 'wp_enqueue_scripts', 'coponix_scripts' ); /** * Register Custom Post Types (Coupons & Stores) */ function coponix_register_cpts() { if ( ! post_type_exists( 'coupon' ) ) { register_post_type( 'coupon', array( 'labels' => array( 'name' => 'الكوبونات', 'singular_name' => 'كوبون', ), 'public' => true, 'has_archive' => true, 'menu_icon' => 'dashicons-tickets-alt', 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'custom-fields' ), 'rewrite' => array( 'slug' => 'coupons' ), 'show_in_rest' => true, )); } if ( ! taxonomy_exists( 'store' ) ) { register_taxonomy( 'store', 'coupon', array( 'labels' => array( 'name' => 'المتاجر', 'singular_name' => 'متجر', ), 'hierarchical' => true, 'show_admin_column' => true, 'show_in_rest' => true, )); } } add_action( 'init', 'coponix_register_cpts' ); /** * Data Import Function */ function coponix_do_import() { $csv_url = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vTaPmGBKx7Mqt77YeaUJN88_77XCqvLHM33uT4-WjomIAXnU-PU5X4II5gaeXAitw/pub?output=csv'; $response = wp_remote_get($csv_url, ['timeout' => 45]); if (is_wp_error($response)) return "Error: " . $response->get_error_message(); $body = wp_remote_retrieve_body($response); $rows = explode("\n", $body); array_shift($rows); // Remove header $count = 0; foreach ($rows as $row_str) { $row = str_getcsv($row_str); if (count($row) < 5) continue; $store_name = trim($row[0]); $geo = trim($row[1]); $category = trim($row[2]); $website = trim($row[3]); $code = trim($row[4]); if (empty($store_name)) continue; $title = "كود خصم " . $store_name . " فعال لعام 2026"; $existing_post = get_page_by_title($title, OBJECT, 'coupon'); if (!$existing_post) { $post_id = wp_insert_post([ 'post_title' => $title, 'post_type' => 'coupon', 'post_status' => 'publish', 'post_excerpt' => "كود خصم " . $store_name . " " . $category . " بقيمة توفير ممتازة لعام 2026", ]); if ($post_id) { update_post_meta($post_id, 'coupon_geo', $geo); update_post_meta($post_id, 'coupon_category', $category); update_post_meta($post_id, 'store_url', $website); update_post_meta($post_id, 'coupon_code', $code); wp_set_object_terms($post_id, $store_name, 'store'); $count++; } } } return "Imported/Synced $count new coupons successfully."; } add_action('init', function() { if (isset($_GET['run_import']) && current_user_can('manage_options')) { $result = coponix_do_import(); wp_die($result . '

Return to Dashboard'); } }); كوبونكس https://validator.w3.org/feed/docs/rss2.html Apple Watch Nike+ كود خصم Mothercare فعال لعام 2026 كود خصم Noon GCC فعال لعام 2026 كود خصم ALNAHDI PHARMACY 2026 كود خصم ToYou فعال لعام 2026 كود خصم Mumzworld فعال لعام 2026 كود خصم The Body Shop West KSA & UAE فعال لعام 2026 كود خصم SquatWolf-CPS 2026 كود خصم New Balance فعال لعام 2026 كود خصم Victoria Secret فعال لعام 2026 كود خصم Eseven فعال لعام 2026 كود خصم Muji فعال لعام 2026 كود خصم Eseven 2026 كود خصم ALHABIB Bedding فعال لعام 2026 كود خصم ALNAHDI PHARMACY فعال لعام 2026 كود خصم SquatWolf-CPS فعال لعام 2026 كود خصم Al Daham فعال لعام 2026 كود خصم Al Matar فعال لعام 2026 Canon EF 70-200mm f/4 L USM كود خصم Al Dakheel Oud فعال لعام 2026 كود خصم GRASSE PERFUME فعال لعام 2026 كود خصم KenzWoman فعال لعام 2026 كود خصم AloKozay فعال لعام 2026 كود خصم Dabdoob فعال لعام 2026 كود خصم Farfetch فعال لعام 2026 Hauwei P30 pro كود خصم Noon Egypt فعال لعام 2026 كود خصم MetroBrazil فعال لعام 2026 كود خصم Waya فعال لعام 2026 كود خصم Styli فعال لعام 2026 كود خصم Al Daham 2026 كود خصم Muji 2026 كود خصم ALHABIB Bedding 2026 Klipsch R-610F Floorstanding Speaker Xiaomi Redmi Note 7 Zimtown Android 6.0 TV Box Rockchip RK3229 Quad Core Metallic Sky Studded Crossbody With Fringe Burberry Beige Cynthie Trench Dress Men’s Gold-Tone Lexington Chronograph Watch MK8494 Emporio Armani Women’s Retro Two-Tone Stainless Steel Quartz Watch AR1926 Dynacraft 24″ Boys’ Tony Hawk Aftermath Bike DJI Osmo Active Camera Charging Dock Stand Station Charger Holder For Apple AmpliFi HD Mesh Router LG V35 ThinQ™ LG Q6™ average smartphone LG Stylo™ 3 Plus Titan Metro Apple iPod Touch كود خصم Namshi فعال لعام 2026 كود خصم H&M فعال لعام 2026