mitdow's picture
🐳 10/02 - 03:35 - I mean I dont have astras original functions.php
d2c10d7 verified
<?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
// ============================================