File size: 3,757 Bytes
6f70cb0
d2c10d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
/**
 * Astra Theme Functions - RESTORED
 */

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

// Define theme constants
if ( ! defined( 'ASTRA_THEME_VERSION' ) ) {
    define( 'ASTRA_THEME_VERSION', '4.6.3' ); // Adjust based on your version
}
define( 'ASTRA_THEME_DIR', trailingslashit( get_template_directory() ) );
define( 'ASTRA_THEME_URI', trailingslashit( esc_url( get_template_directory_uri() ) ) );

// Load Astra theme setup
require_once ASTRA_THEME_DIR . 'inc/class-astra-theme.php';

// Initialize Astra Theme
if ( class_exists( 'Astra_Theme' ) ) {
    Astra_Theme::get_instance();
}

// ============================================
// CUSTOM: Used Car Buyers AI Template Support
// ============================================

/**
 * Enqueues scripts and styles for Used Car Buyers AI templates
 */
function usedcarbuyers_ai_scripts() {
    // Only load on our custom templates
    if ( is_page_template( 'template-usedcarbuyers.php' ) || is_page_template( 'template-home-usedcarbuyers.php' ) ) {
        
        // Tailwind CSS (loaded as script for CDN)
        wp_enqueue_script( 'tailwind', 'https://cdn.tailwindcss.com', array(), null, false );
        
        // Feather Icons
        wp_enqueue_script( 'feather-icons', 'https://unpkg.com/feather-icons', array(), null, true );
        
        // Custom styles
        wp_enqueue_style( 'usedcarbuyers-ai-styles', get_stylesheet_directory_uri() . '/style-usedcarbuyers.css', array(), '1.0.0' );
        
        // Custom scripts
        wp_enqueue_script( 'usedcarbuyers-ai-scripts', get_stylesheet_directory_uri() . '/script-usedcarbuyers.js', array( 'feather-icons' ), '1.0.0', true );
        
        // Tailwind config inline
        $tailwind_config = '
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: "#1e40af",
                        secondary: "#f59e0b",
                        accent: "#dc2626",
                        dark: "#0f172a",
                        light: "#f8fafc"
                    },
                    animation: {
                        "float": "float 6s ease-in-out infinite",
                        "glow": "glow 2s ease-in-out infinite alternate",
                        "slide-in": "slideIn 0.5s ease-out"
                    },
                    keyframes: {
                        float: {
                            "0%, 100%": { transform: "translateY(0)" },
                            "50%": { transform: "translateY(-20px)" }
                        },
                        glow: {
                            "0%": { boxShadow: "0 0 20px #3b82f6" },
                            "100%": { boxShadow: "0 0 30px #1e40af, 0 0 40px #1d4ed8" }
                        },
                        slideIn: {
                            "0%": { transform: "translateY(100px)", opacity: "0" },
                            "100%": { transform: "translateY(0)", opacity: "1" }
                        }
                    }
                }
            }
        }';
        wp_add_inline_script( 'tailwind', $tailwind_config );
    }
}
add_action( 'wp_enqueue_scripts', 'usedcarbuyers_ai_scripts', 20 );

/**
 * Initialize feather icons after footer
 */
function usedcarbuyers_ai_feather_init() {
    if ( is_page_template( 'template-usedcarbuyers.php' ) || is_page_template( 'template-home-usedcarbuyers.php' ) ) {
        echo '<script>if(typeof feather !== "undefined") { feather.replace(); }</script>';
    }
}
add_action( 'wp_footer', 'usedcarbuyers_ai_feather_init', 99 );

// ============================================
// END CUSTOM Used Car Buyers AI Support
// ============================================