/assets/images/favicon.svg"> // cuando tengas el fichero subido. Por ahora usamos el SVG inline: echo '' . "\n"; } /** * 6. Registrar Custom Post Type: Testimonios (opcional, para gestionar desde WP-Admin) */ add_action( 'init', 'encaja_register_testimonios_cpt' ); function encaja_register_testimonios_cpt() { register_post_type( 'encaja_testimonio', array( 'labels' => array( 'name' => 'Testimonios', 'singular_name' => 'Testimonio', 'add_new_item' => 'Añadir testimonio', 'edit_item' => 'Editar testimonio', ), 'public' => false, 'show_ui' => true, 'show_in_menu' => true, 'supports' => array( 'title', 'editor', 'custom-fields' ), 'menu_icon' => 'dashicons-format-quote', )); } /** * 7. Registrar opciones globales de marca en Customizer * (para cambiar teléfono, email, etc. desde Apariencia > Personalizar) */ add_action( 'customize_register', 'encaja_customizer_settings' ); function encaja_customizer_settings( $wp_customize ) { $wp_customize->add_section( 'encaja_contacto', array( 'title' => 'ENCAJA — Datos de contacto', 'priority' => 30, )); // Teléfono $wp_customize->add_setting( 'encaja_telefono', array( 'default' => '649 134 029', 'transport' => 'refresh', )); $wp_customize->add_control( 'encaja_telefono', array( 'label' => 'Teléfono principal', 'section' => 'encaja_contacto', 'type' => 'text', )); // WhatsApp $wp_customize->add_setting( 'encaja_whatsapp', array( 'default' => '34649134029', 'transport' => 'refresh', )); $wp_customize->add_control( 'encaja_whatsapp', array( 'label' => 'Número WhatsApp (sin + ni espacios, ej: 34649134029)', 'section' => 'encaja_contacto', 'type' => 'text', )); // Email $wp_customize->add_setting( 'encaja_email', array( 'default' => 'info@encaja.es', 'transport' => 'refresh', )); $wp_customize->add_control( 'encaja_email', array( 'label' => 'Email de contacto', 'section' => 'encaja_contacto', 'type' => 'text', )); } /** * Helper: obtener teléfono desde Customizer */ function encaja_get_telefono() { return esc_html( get_theme_mod( 'encaja_telefono', '649 134 029' ) ); } function encaja_get_whatsapp_num() { return esc_attr( get_theme_mod( 'encaja_whatsapp', '34649134029' ) ); } function encaja_get_email() { return esc_html( get_theme_mod( 'encaja_email', 'info@encaja.es' ) ); } /** * 8. Shortcodes útiles para usar dentro de Elementor (widget HTML o Text) * * Uso: [encaja_tel] → 649 134 029 * [encaja_whatsapp_link texto="Escríbenos"] * [encaja_email] */ add_shortcode( 'encaja_tel', function() { $tel = encaja_get_telefono(); $tel_limpio = preg_replace('/\s+/', '', $tel); return '' . $tel . ''; }); add_shortcode( 'encaja_email', function() { $email = encaja_get_email(); return '' . $email . ''; }); add_shortcode( 'encaja_whatsapp_link', function( $atts ) { $atts = shortcode_atts( array( 'texto' => 'Contactar por WhatsApp', 'mensaje' => 'Hola%2C%20me%20gustar%C3%ADa%20pedir%20presupuesto.', ), $atts ); $num = encaja_get_whatsapp_num(); return '' . esc_html( $atts['texto'] ) . ''; }); /** * 9. Añadir botones flotantes (WhatsApp + CTA) al footer del sitio * Se puede desactivar desde Personalizar si se prefiere gestionar con Elementor */ add_action( 'wp_footer', 'encaja_floating_buttons' ); function encaja_floating_buttons() { $wa_num = encaja_get_whatsapp_num(); $wa_msg = urlencode('Hola, me gustaría pedir presupuesto para una mudanza.'); ?> Presupuesto gratis

Welcome to WordPress. This is your first post. Edit or delete it, then start writing!

Un comentario

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *