| <?php |
| |
| |
| |
| |
| |
| |
|
|
| |
| if (!defined('ABSPATH')) { |
| exit; |
| } |
|
|
| |
| |
| |
| function isabella_setup() { |
| |
| add_theme_support('title-tag'); |
| |
| |
| add_theme_support('post-thumbnails'); |
| set_post_thumbnail_size(1200, 630, true); |
| add_image_size('portfolio', 640, 360, true); |
| add_image_size('testimonial', 200, 200, true); |
| add_image_size('instagram', 320, 240, true); |
| |
| |
| register_nav_menus(array( |
| 'primary' => __('Men煤 Principal', 'isabella'), |
| 'footer' => __('Men煤 Footer', 'isabella'), |
| )); |
| |
| |
| add_theme_support('html5', array( |
| 'search-form', |
| 'comment-form', |
| 'comment-list', |
| 'gallery', |
| 'caption', |
| 'style', |
| 'script', |
| )); |
| |
| |
| add_theme_support('woocommerce'); |
| |
| |
| add_theme_support('editor-styles'); |
| add_editor_style('assets/css/editor-style.css'); |
| } |
| add_action('after_setup_theme', 'isabella_setup'); |
|
|
| |
| |
| |
| function isabella_scripts() { |
| |
| wp_enqueue_style( |
| 'isabella-fonts', |
| 'https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Lato:wght@300;400;700&display=swap', |
| array(), |
| null |
| ); |
| |
| |
| wp_enqueue_script( |
| 'tailwindcss', |
| 'https://cdn.tailwindcss.com', |
| array(), |
| null, |
| false |
| ); |
| |
| |
| wp_enqueue_script( |
| 'lucide-icons', |
| 'https://unpkg.com/lucide@latest', |
| array(), |
| null, |
| true |
| ); |
| |
| |
| wp_enqueue_style( |
| 'isabella-style', |
| get_stylesheet_uri(), |
| array(), |
| '1.0.0' |
| ); |
| |
| wp_enqueue_style( |
| 'isabella-custom', |
| get_template_directory_uri() . '/assets/css/custom.css', |
| array(), |
| '1.0.0' |
| ); |
| |
| |
| wp_enqueue_script( |
| 'isabella-main', |
| get_template_directory_uri() . '/assets/js/main.js', |
| array('lucide-icons'), |
| '1.0.0', |
| true |
| ); |
| |
| |
| wp_localize_script('isabella-main', 'isabella_ajax', array( |
| 'ajax_url' => admin_url('admin-ajax.php'), |
| 'nonce' => wp_create_nonce('isabella_nonce') |
| )); |
| } |
| add_action('wp_enqueue_scripts', 'isabella_scripts'); |
|
|
| |
| |
| |
| function isabella_tailwind_config() { |
| ?> |
| <script> |
| tailwind.config = { |
| theme: { |
| extend: { |
| fontFamily: { |
| 'serif': ['Playfair Display', 'serif'], |
| 'sans': ['Lato', 'sans-serif'], |
| }, |
| colors: { |
| 'brand': { |
| 50: '#fdf2f8', |
| 100: '#fce7f3', |
| 200: '#fbcfe8', |
| 300: '#f9a8d4', |
| 400: '#f472b6', |
| 500: '#ec4899', |
| 600: '#db2777', |
| 700: '#be185d', |
| 800: '#9d174d', |
| 900: '#831843', |
| }, |
| 'gold': { |
| 400: '#fbbf24', |
| 500: '#f59e0b', |
| 600: '#d97706', |
| } |
| } |
| } |
| } |
| } |
| </script> |
| <?php |
| } |
| add_action('wp_head', 'isabella_tailwind_config', 1); |
|
|
| |
| |
| |
| function isabella_portfolio_post_type() { |
| $labels = array( |
| 'name' => __('Portafolio', 'isabella'), |
| 'singular_name' => __('Proyecto', 'isabella'), |
| 'add_new' => __('A帽adir Nuevo', 'isabella'), |
| 'add_new_item' => __('A帽adir Nuevo Proyecto', 'isabella'), |
| 'edit_item' => __('Editar Proyecto', 'isabella'), |
| 'new_item' => __('Nuevo Proyecto', 'isabella'), |
| 'view_item' => __('Ver Proyecto', 'isabella'), |
| 'search_items' => __('Buscar Proyectos', 'isabella'), |
| 'not_found' => __('No se encontraron proyectos', 'isabella'), |
| ); |
| |
| $args = array( |
| 'labels' => $labels, |
| 'public' => true, |
| 'has_archive' => true, |
| 'publicly_queryable' => true, |
| 'show_ui' => true, |
| 'show_in_menu' => true, |
| 'menu_position' => 5, |
| 'menu_icon' => 'dashicons-format-gallery', |
| 'supports' => array('title', 'editor', 'thumbnail', 'excerpt', 'custom-fields'), |
| 'taxonomies' => array('portfolio_category'), |
| 'rewrite' => array('slug' => 'portafolio'), |
| ); |
| |
| register_post_type('portfolio', $args); |
| } |
| add_action('init', 'isabella_portfolio_post_type'); |
|
|
| |
| |
| |
| function isabella_portfolio_taxonomy() { |
| $labels = array( |
| 'name' => __('Categor铆as', 'isabella'), |
| 'singular_name' => __('Categor铆a', 'isabella'), |
| ); |
| |
| $args = array( |
| 'labels' => $labels, |
| 'hierarchical' => true, |
| 'public' => true, |
| 'show_ui' => true, |
| 'show_admin_column' => true, |
| 'query_var' => true, |
| 'rewrite' => array('slug' => 'categoria-portafolio'), |
| ); |
| |
| register_taxonomy('portfolio_category', array('portfolio'), $args); |
| } |
| add_action('init', 'isabella_portfolio_taxonomy'); |
|
|
| |
| |
| |
| function isabella_testimonials_post_type() { |
| $labels = array( |
| 'name' => __('Testimonios', 'isabella'), |
| 'singular_name' => __('Testimonio', 'isabella'), |
| ); |
| |
| $args = array( |
| 'labels' => $labels, |
| 'public' => false, |
| 'publicly_queryable' => false, |
| 'show_ui' => true, |
| 'show_in_menu' => true, |
| 'menu_position' => 6, |
| 'menu_icon' => 'dashicons-format-quote', |
| 'supports' => array('title', 'editor', 'thumbnail'), |
| ); |
| |
| register_post_type('testimonial', $args); |
| } |
| add_action('init', 'isabella_testimonials_post_type'); |
|
|
| |
| |
| |
| function isabella_services_post_type() { |
| $labels = array( |
| 'name' => __('Servicios', 'isabella'), |
| 'singular_name' => __('Servicio', 'isabella'), |
| ); |
| |
| $args = array( |
| 'labels' => $labels, |
| 'public' => false, |
| 'publicly_queryable' => false, |
| 'show_ui' => true, |
| 'show_in_menu' => true, |
| 'menu_position' => 7, |
| 'menu_icon' => 'dashicons-star-filled', |
| 'supports' => array('title', 'editor', 'thumbnail'), |
| ); |
| |
| register_post_type('service', $args); |
| } |
| add_action('init', 'isabella_services_post_type'); |
|
|
| |
| |
| |
| function isabella_customize_register($wp_customize) { |
| |
| $wp_customize->add_section('isabella_general', array( |
| 'title' => __('Informaci贸n General', 'isabella'), |
| 'priority' => 30, |
| )); |
| |
| |
| $wp_customize->add_setting('isabella_email', array( |
| 'default' => 'booking@isabellamoreno.com', |
| 'sanitize_callback' => 'sanitize_email', |
| )); |
| |
| $wp_customize->add_control('isabella_email', array( |
| 'label' => __('Email de Contacto', 'isabella'), |
| 'section' => 'isabella_general', |
| 'type' => 'email', |
| )); |
| |
| |
| $wp_customize->add_setting('isabella_phone', array( |
| 'default' => '+1 (305) 555-0123', |
| 'sanitize_callback' => 'sanitize_text_field', |
| )); |
| |
| $wp_customize->add_control('isabella_phone', array( |
| 'label' => __('Tel茅fono', 'isabella'), |
| 'section' => 'isabella_general', |
| 'type' => 'text', |
| )); |
| |
| |
| $wp_customize->add_setting('isabella_location', array( |
| 'default' => 'Miami, FL', |
| 'sanitize_callback' => 'sanitize_text_field', |
| )); |
| |
| $wp_customize->add_control('isabella_location', array( |
| 'label' => __('Ubicaci贸n', 'isabella'), |
| 'section' => 'isabella_general', |
| 'type' => 'text', |
| )); |
| |
| |
| $wp_customize->add_section('isabella_social', array( |
| 'title' => __('Redes Sociales', 'isabella'), |
| 'priority' => 35, |
| )); |
| |
| $socials = array('instagram', 'twitter', 'facebook', 'linkedin'); |
| foreach ($socials as $social) { |
| $wp_customize->add_setting("isabella_{$social}", array( |
| 'sanitize_callback' => 'esc_url_raw', |
| )); |
| |
| $wp_customize->add_control("isabella_{$social}", array( |
| 'label' => ucfirst($social), |
| 'section' => 'isabella_social', |
| 'type' => 'url', |
| )); |
| } |
| } |
| add_action('customize_register', 'isabella_customize_register'); |
|
|
| |
| |
| |
| function isabella_widgets_init() { |
| register_sidebar(array( |
| 'name' => __('Sidebar Footer', 'isabella'), |
| 'id' => 'footer-1', |
| 'description' => __('Widgets para el footer', 'isabella'), |
| 'before_widget' => '<div class="widget">', |
| 'after_widget' => '</div>', |
| 'before_title' => '<h3 class="widget-title">', |
| 'after_title' => '</h3>', |
| )); |
| } |
| add_action('widgets_init', 'isabella_widgets_init'); |
|
|
| |
| |
| |
| function isabella_handle_contact_form() { |
| check_ajax_referer('isabella_nonce', 'nonce'); |
| |
| $name = sanitize_text_field($_POST['name']); |
| $email = sanitize_email($_POST['email']); |
| $project = sanitize_text_field($_POST['project']); |
| $message = sanitize_textarea_field($_POST['message']); |
| |
| $to = get_option('admin_email'); |
| $subject = "Nuevo mensaje de contacto de {$name}"; |
| $body = "Nombre: {$name}\nEmail: {$email}\nTipo de proyecto: {$project}\n\nMensaje:\n{$message}"; |
| $headers = array('Content-Type: text/plain; charset=UTF-8', "Reply-To: {$email}"); |
| |
| $sent = wp_mail($to, $subject, $body, $headers |