Doctorrick's picture
Initial DeepSite commit
bf98100 verified
Raw
History Blame Contribute Delete
10.3 kB
<?php
/**
* Isabella Moreno - Tema de WordPress
*
* @package IsabellaMoreno
* @version 1.0.0
*/
// Prevenir acceso directo
if (!defined('ABSPATH')) {
exit;
}
/**
* Configuraci贸n del tema
*/
function isabella_setup() {
// Soporte para t铆tulo din谩mico
add_theme_support('title-tag');
// Soporte para im谩genes destacadas
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);
// Men煤s de navegaci贸n
register_nav_menus(array(
'primary' => __('Men煤 Principal', 'isabella'),
'footer' => __('Men煤 Footer', 'isabella'),
));
// Soporte para HTML5
add_theme_support('html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
'style',
'script',
));
// Soporte para WooCommerce (opcional)
add_theme_support('woocommerce');
// Soporte para Gutenberg
add_theme_support('editor-styles');
add_editor_style('assets/css/editor-style.css');
}
add_action('after_setup_theme', 'isabella_setup');
/**
* Enqueue scripts y estilos
*/
function isabella_scripts() {
// Google Fonts
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
);
// Tailwind CSS
wp_enqueue_script(
'tailwindcss',
'https://cdn.tailwindcss.com',
array(),
null,
false
);
// Lucide Icons
wp_enqueue_script(
'lucide-icons',
'https://unpkg.com/lucide@latest',
array(),
null,
true
);
// Estilos personalizados
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'
);
// Scripts personalizados
wp_enqueue_script(
'isabella-main',
get_template_directory_uri() . '/assets/js/main.js',
array('lucide-icons'),
'1.0.0',
true
);
// Configuraci贸n AJAX
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');
/**
* Configuraci贸n de Tailwind
*/
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);
/**
* Custom Post Type: Portafolio
*/
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');
/**
* Taxonom铆a: Categor铆as de Portafolio
*/
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');
/**
* Custom Post Type: Testimonios
*/
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');
/**
* Custom Post Type: Servicios
*/
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');
/**
* Opciones del Tema (ACF o Customizer)
*/
function isabella_customize_register($wp_customize) {
// Secci贸n de Informaci贸n General
$wp_customize->add_section('isabella_general', array(
'title' => __('Informaci贸n General', 'isabella'),
'priority' => 30,
));
// Email de contacto
$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',
));
// Tel茅fono
$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',
));
// Ubicaci贸n
$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',
));
// Redes Sociales
$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');
/**
* Widgets
*/
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');
/**
* Manejo de formulario de contacto AJAX
*/
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