?php /** * Theme functions and definitions. * * For additional information on potential customization options, * read the developers' documentation: * * https://developers.elementor.com/docs/hello-elementor-theme/ * * @package HelloElementorChild */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } define( 'HELLO_ELEMENTOR_CHILD_VERSION', '2.0.0' ); /** * Load child theme scripts & styles. * * @return void */ function hello_elementor_child_scripts_styles() { wp_enqueue_script( 'custom-script', get_stylesheet_directory_uri() . '/custom.js', array( 'jquery' ) ); wp_enqueue_style( 'hello-elementor-child-style', get_stylesheet_directory_uri() . '/style.css', [ 'hello-elementor-theme-style', ], HELLO_ELEMENTOR_CHILD_VERSION ); } add_action( 'wp_enqueue_scripts', 'hello_elementor_child_scripts_styles', 20 ); function acfcustom_fn($atts) { // Definimos los atributos predeterminados $atts = shortcode_atts( array( 'field' => '', 'post_id' => get_the_ID(), ), $atts ); // Inicializamos $output y asignamos el valor del campo ACF $output = ''; if (!empty($atts['field'])) { $output .= get_field($atts['field'], $atts['post_id']); } return $output; } add_shortcode('acfcustom', 'acfcustom_fn'); function mostrar_titulo_acf_shortcode() { // 1. Obtener el valor del campo ACF 'titulo' para la página/post actual. $titulo_acf = get_field('titulo'); // 2. Comprobar si el campo ACF está vacío (incluyendo nulo, falso, o cadena vacía). if ( empty( $titulo_acf ) ) { // Si está vacío: Obtener y retornar el título por defecto del post/página. $titulo_pagina = get_the_title(); return '