• Hola a todos. Utilizo el plugin Advanced Custom Fields 4.4.3 y WordPress 4.3.1 y el theme Reales WP (ventas inmobiliarias). Necesitaba insertar en el backend de las propiedades un campo para aquellos inmuebles Vendidos, ya que el theme no lo trae por defecto. Lo he hecho desde el plugin ACF. He programado un checkbox con una condición. Al activarlo, el frontend de la propiedad inserta un texto (VENDIDO). Aquí no he tenido problemas. Podéis ver el resultado aquí: http://invertiainmobiliaria.com/properties/venta-de-solares-en-zona-la-calera-el-cuervo-de-sevilla

    Ésto lo he conseguido hacer con algo de CSS y el código que sugieren desde el plugin:

    <?php 
    
    $selected = get_field('mostrar_vendido');
    
    if( in_array('Si', $selected) ) {
    
    	echo 'VENDIDO';
    
    }
    
    ?>

    El problema me surge porque el texto VENDIDO también quiero que aparezca en el inmueble cuando lo muestra en la Home: http://invertiainmobiliaria.com

    Para mostrar los inmuebles en la Home, el theme utiliza un plugin llamado short-tax-post donde se definen los shortcodes. El código del plugin es el siguiente:

    <?php
    /*
    * Plugin Name: Reales WP STPT
    * Description: Creates shortcodes, register custom taxonomies and post types
    * Version: 1.0.3
    * Author: Marius Nastase
    * Author URI: http://mariusn.com
    */
    
    add_action( 'plugins_loaded', 'reales_load_textdomain' );
    function reales_load_textdomain() {
        load_plugin_textdomain( 'reales', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
    }
    
    /**
     *****************************************************************************
     * Shortcodes
     *****************************************************************************
     */
    
    if( !function_exists('reales_register_buttons') ):
        function reales_register_buttons($buttons) {
            array_push($buttons, "|", "services");
            array_push($buttons, "|", "recent_properties");
            array_push($buttons, "|", "featured_properties");
            array_push($buttons, "|", "featured_agents");
            array_push($buttons, "|", "testimonials");
            array_push($buttons, "|", "latest_posts");
            array_push($buttons, "|", "featured_posts");
            array_push($buttons, "|", "column");
    
            return $buttons;
        }
    endif;
    
    if( !function_exists('reales_add_plugins') ):
        function reales_add_plugins($plugin_array) {
            $plugin_array['services'] = plugin_dir_url( __FILE__ ) . '/js/shortcodes.js';
            $plugin_array['recent_properties'] = plugin_dir_url( __FILE__ ) . '/js/shortcodes.js';
            $plugin_array['featured_properties'] = plugin_dir_url( __FILE__ ) . '/js/shortcodes.js';
            $plugin_array['featured_agents'] = plugin_dir_url( __FILE__ ) . '/js/shortcodes.js';
            $plugin_array['testimonials'] = plugin_dir_url( __FILE__ ) . '/js/shortcodes.js';
            $plugin_array['latest_posts'] = plugin_dir_url( __FILE__ ) . '/js/shortcodes.js';
            $plugin_array['featured_posts'] = plugin_dir_url( __FILE__ ) . '/js/shortcodes.js';
            $plugin_array['column'] = plugin_dir_url( __FILE__ ) . '/js/shortcodes.js';
            return $plugin_array;
        }
    endif;
    
    if( !function_exists('reales_register_plugin_buttons') ):
        function reales_register_plugin_buttons() {
            if(!current_user_can('edit_posts') && !current_user_can('edit_pages')) {
                return;
            }
    
            if(get_user_option('rich_editing') == 'true') {
                add_filter('mce_external_plugins', 'reales_add_plugins');
                add_filter('mce_buttons_3', 'reales_register_buttons');
            }
        }
    endif;
    
    if( !function_exists('reales_register_shortcodes') ):
        function reales_register_shortcodes() {
            add_shortcode('services', 'reales_services_shortcode');
            add_shortcode('recent_properties', 'reales_recent_properties_shortcode');
            add_shortcode('featured_properties', 'reales_featured_properties_shortcode');
            add_shortcode('featured_agents', 'reales_featured_agents_shortcode');
            add_shortcode('testimonials', 'reales_testimonials_shortcode');
            add_shortcode('latest_posts', 'reales_latest_posts_shortcode');
            add_shortcode('featured_posts', 'reales_featured_posts_shortcode');
            add_shortcode('column', 'reales_column_shortcode');
        }
    endif;
    
    add_action('init', 'reales_register_plugin_buttons');
    add_action('init', 'reales_register_shortcodes');
    
    /**
     * Services shortcode
     */
    if( !function_exists('reales_services_shortcode') ):
        function reales_services_shortcode($attrs, $content = null) {
            extract(shortcode_atts(array(
                'stitle' => 'Services Title',
                'show' => '4',
                's1icon' => 'icon-pointer',
                's1title' => '1st Service Title',
                's1text' => '1st Service Text',
                's1link' => '#',
                's2icon' => 'icon-users',
                's2title' => '2nd Service Title',
                's2text' => '2nd Service Text',
                's2link' => '#',
                's3icon' => 'icon-home',
                's3title' => '3rd Service Title',
                's3text' => '3rd Service Text',
                's3link' => '3rd Service Link',
                's4icon' => 'icon-cloud-upload',
                's4title' => '4th Service Title',
                's4text' => '4th Service Text',
                's4link' => '#'
            ), $attrs));
    
            $return_string = '<h2 class="osLight centered">' . esc_html($stitle) . '</h2>';
            $return_string .= '<div class="row pb40">';
    
            if(esc_html($show) == '2') {
                $return_string .= '<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 s-menu-item">';
                $return_string .= '<a href="' . esc_url($s1link) . '">';
                $return_string .= '<span class="' . esc_attr($s1icon) . ' s-icon"></span>';
                $return_string .= '<div class="s-content">';
                $return_string .= '<h2 class="centered s-main osLight">' . esc_html($s1title) . '</h2>';
                $return_string .= '<h3 class="s-sub osLight">' . esc_html($s1text) . '</h3>';
                $return_string .= '</div>';
                $return_string .= '</a>';
                $return_string .= '</div>';
    
                $return_string .= '<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 s-menu-item">';
                $return_string .= '<a href="' . esc_url($s2link) . '">';
                $return_string .= '<span class="' . esc_attr($s2icon) . ' s-icon"></span>';
                $return_string .= '<div class="s-content">';
                $return_string .= '<h2 class="centered s-main osLight">' . esc_html($s2title) . '</h2>';
                $return_string .= '<h3 class="s-sub osLight">' . esc_html($s2text) . '</h3>';
                $return_string .= '</div>';
                $return_string .= '</a>';
                $return_string .= '</div>';
            } else if(esc_html($show) == '3') {
                $return_string .= '<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4 s-menu-item">';
                $return_string .= '<a href="' . esc_url($s1link) . '">';
                $return_string .= '<span class="' . esc_attr($s1icon) . ' s-icon"></span>';
                $return_string .= '<div class="s-content">';
                $return_string .= '<h2 class="centered s-main osLight">' . esc_html($s1title) . '</h2>';
                $return_string .= '<h3 class="s-sub osLight">' . esc_html($s1text) . '</h3>';
                $return_string .= '</div>';
                $return_string .= '</a>';
                $return_string .= '</div>';
    
                $return_string .= '<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4 s-menu-item">';
                $return_string .= '<a href="' . esc_url($s2link) . '">';
                $return_string .= '<span class="' . esc_attr($s2icon) . ' s-icon"></span>';
                $return_string .= '<div class="s-content">';
                $return_string .= '<h2 class="centered s-main osLight">' . esc_html($s2title) . '</h2>';
                $return_string .= '<h3 class="s-sub osLight">' . esc_html($s2text) . '</h3>';
                $return_string .= '</div>';
                $return_string .= '</a>';
                $return_string .= '</div>';
    
                $return_string .= '<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4 s-menu-item">';
                $return_string .= '<a href="' . esc_url($s3link) . '">';
                $return_string .= '<span class="' . esc_attr($s3icon) . ' s-icon"></span>';
                $return_string .= '<div class="s-content">';
                $return_string .= '<h2 class="centered s-main osLight">' . esc_html($s3title) . '</h2>';
                $return_string .= '<h3 class="s-sub osLight">' . esc_html($s3text) . '</h3>';
                $return_string .= '</div>';
                $return_string .= '</a>';
                $return_string .= '</div>';
            } else {
                $return_string .= '<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 s-menu-item">';
                $return_string .= '<a href="' . esc_url($s1link) . '">';
                $return_string .= '<span class="' . esc_attr($s1icon) . ' s-icon"></span>';
                $return_string .= '<div class="s-content">';
                $return_string .= '<h2 class="centered s-main osLight">' . esc_html($s1title) . '</h2>';
                $return_string .= '<h3 class="s-sub osLight">' . esc_html($s1text) . '</h3>';
                $return_string .= '</div>';
                $return_string .= '</a>';
                $return_string .= '</div>';
    
                $return_string .= '<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 s-menu-item">';
                $return_string .= '<a href="' . esc_url($s2link) . '">';
                $return_string .= '<span class="' . esc_attr($s2icon) . ' s-icon"></span>';
                $return_string .= '<div class="s-content">';
                $return_string .= '<h2 class="centered s-main osLight">' . esc_html($s2title) . '</h2>';
                $return_string .= '<h3 class="s-sub osLight">' . esc_html($s2text) . '</h3>';
                $return_string .= '</div>';
                $return_string .= '</a>';
                $return_string .= '</div>';
    
                $return_string .= '<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 s-menu-item">';
                $return_string .= '<a href="' . esc_url($s3link) . '">';
                $return_string .= '<span class="' . esc_attr($s3icon) . ' s-icon"></span>';
                $return_string .= '<div class="s-content">';
                $return_string .= '<h2 class="centered s-main osLight">' . esc_html($s3title) . '</h2>';
                $return_string .= '<h3 class="s-sub osLight">' . esc_html($s3text) . '</h3>';
                $return_string .= '</div>';
                $return_string .= '</a>';
                $return_string .= '</div>';
    
                $return_string .= '<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 s-menu-item">';
                $return_string .= '<a href="' . esc_url($s4link) . '">';
                $return_string .= '<span class="' . esc_attr($s4icon) . ' s-icon"></span>';
                $return_string .= '<div class="s-content">';
                $return_string .= '<h2 class="centered s-main osLight">' . esc_html($s4title) . '</h2>';
                $return_string .= '<h3 class="s-sub osLight">' . esc_html($s4text) . '</h3>';
                $return_string .= '</div>';
                $return_string .= '</a>';
                $return_string .= '</div>';
            }
    
            $return_string .= '</div>';
    
            wp_reset_query();
            return $return_string;
        }
    endif;
    
    /**
     * Recent properties shortcode
     */
    if( !function_exists('reales_recent_properties_shortcode') ):
        function reales_recent_properties_shortcode($attrs, $content = null) {
            extract(shortcode_atts(array(
                'title' => 'Recently Listed Properties'
            ), $attrs));
    
            if(isset($attrs['show']) && is_numeric($attrs['show'])) {
                $show = $attrs['show'];
            } else {
                $show = '6';
            }
    
            $args = array(
                'numberposts'   => $show,
                'post_type'        => 'property',
                'order' => 'DESC',
                'post_status'      => 'publish');
            $posts = wp_get_recent_posts($args);
    
            $return_string = '<h2 class="centered osLight">' . esc_html($title) . '</h2>';
            $return_string .= '<div class="row pb40">';
            foreach($posts as $post) :
                $gallery = get_post_meta($post["ID"], 'property_gallery', true);
                $images = explode("~~~", $gallery);
                $price = get_post_meta($post["ID"], 'property_price', true);
                $reales_general_settings = get_option('reales_general_settings');
                $currency = isset($reales_general_settings['reales_currency_symbol_field']) ? $reales_general_settings['reales_currency_symbol_field'] : '';
                $currency_pos = isset($reales_general_settings['reales_currency_symbol_pos_field']) ? $reales_general_settings['reales_currency_symbol_pos_field'] : '';
                $price_label = get_post_meta($post["ID"], 'property_price_label', true);
                setlocale(LC_MONETARY, 'en_US');
                $address = get_post_meta($post["ID"], 'property_address', true);
                $city = get_post_meta($post["ID"], 'property_city', true);
                $zip = get_post_meta($post["ID"], 'property_zip', true);
                $country = get_post_meta($post["ID"], 'property_country', true);
                $type =  wp_get_post_terms($post["ID"], 'property_type_category');
    
                if(intval($show) % 3 == 0) {
                    $return_string .= '<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4">';
                } else {
                    $return_string .= '<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6">';
                }
    			$return_string .= '<a href="' . esc_url(get_permalink($post["ID"])) . '" class="propWidget-2">';
                $return_string .= '<div class="fig">';
    			$return_string .= '<img src="' . esc_url($images[1]) . '" alt="' . esc_attr($post["post_title"]) . '" class="scale" data-scale="best-fill" data-align="center">';
                $return_string .= '<img src="' . esc_url($images[1]) . '" alt="' . esc_attr($post["post_title"]) . '" class="blur scale" data-scale="best-fill" data-align="center">';
                $return_string .= '<div class="opac"></div>';
    			if($currency_pos == 'before') {
                    $return_string .= '<div class="priceCap osLight"><span>' . esc_html($currency) . money_format('%!.0i', esc_html($price)) . esc_html($price_label) . '</span></div>';
                } else {
                    $return_string .= '<div class="priceCap osLight"><span>' . money_format('%!.0i', esc_html($price)) . esc_html($currency) . esc_html($price_label) . '</span></div>';
                }
                if($type) {
                    $return_string .= '<div class="figType">' . esc_html($type[0]->name) . '</div>';
                }
                $return_string .= '<h3 class="osLight">' . esc_html($post["post_title"]) . '</h3>';
                $return_string .= '<div class="address">';
                if($address != '') {
                    $return_string .= esc_html($address) . ', ';
                }
                if($city != '') {
                    $return_string .= esc_html($city) . ', ';
                }
                $return_string .= esc_html($country);
                $return_string .= '</div></div>';
                $return_string .= '</a>';
                $return_string .= '</div>';
            endforeach;
            $return_string .= '</div>';
    
            wp_reset_postdata();
            wp_reset_query();
            return $return_string;
        }
    endif;
    
    /**
     * Featured properties shortcode
     */
    if( !function_exists('reales_featured_properties_shortcode') ):
        function reales_featured_properties_shortcode($attrs, $content = null) {
            extract(shortcode_atts(array(
                'title' => 'Featured Properties'
            ), $attrs));
    
            if(isset($attrs['show']) && is_numeric($attrs['show'])) {
                $show = $attrs['show'];
            } else {
                $show = '3';
            }
    
            $args = array(
                'numberposts'   => $show,
                'post_type'        => 'property',
                'order' => 'DESC',
                'meta_key'         => 'property_featured',
                'meta_value'       => '1',
                'post_status'      => 'publish');
            $posts = get_posts($args);
    
            $return_string = '<h2 class="centered osLight">' . esc_html($title) . '</h2>';
            $return_string .= '<div class="row pb40">';
            foreach($posts as $post) : setup_postdata($post);
                $gallery = get_post_meta($post->ID, 'property_gallery', true);
                $images = explode("~~~", $gallery);
                $price = get_post_meta($post->ID, 'property_price', true);
                $reales_general_settings = get_option('reales_general_settings');
                $currency = isset($reales_general_settings['reales_currency_symbol_field']) ? $reales_general_settings['reales_currency_symbol_field'] : '';
                $currency_pos = isset($reales_general_settings['reales_currency_symbol_pos_field']) ? $reales_general_settings['reales_currency_symbol_pos_field'] : '';
                $price_label = get_post_meta($post->ID, 'property_price_label', true);
                setlocale(LC_MONETARY, 'en_US');
                $address = get_post_meta($post->ID, 'property_address', true);
                $city = get_post_meta($post->ID, 'property_city', true);
                $zip = get_post_meta($post->ID, 'property_zip', true);
                $country = get_post_meta($post->ID, 'property_country', true);
                $type =  wp_get_post_terms($post->ID, 'property_type_category');
    
                if(intval($show) % 3 == 0) {
                    $return_string .= '<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4">';
                } else {
                    $return_string .= '<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6">';
                }
                $return_string .= '<a href="' . esc_url(get_permalink($post->ID)) . '" class="propWidget-2">';
                $return_string .= '<div class="fig">';
                $return_string .= '<img src="' . esc_url($images[1]) . '" alt="' . esc_attr($post->post_title) . '" class="scale" data-scale="best-fill" data-align="center">';
                $return_string .= '<img src="' . esc_url($images[1]) . '" alt="' . esc_attr($post->post_title) . '" class="blur scale" data-scale="best-fill" data-align="center">';
    			$return_string .= '<div class="opac"></div>';
                if($currency_pos == 'before') {
                    $return_string .= '<div class="priceCap osLight"><span>' . esc_html($currency) . money_format('%!.0i', esc_html($price)) . esc_html($price_label) . '</span></div>';
                } else {
                    $return_string .= '<div class="priceCap osLight"><span>' . money_format('%!.0i', esc_html($price)) . esc_html($currency) . esc_html($price_label) . '</span></div>';
                }
                if($type) {
                    $return_string .= '<div class="figType">' . esc_html($type[0]->name) . '</div>';
    
                }
                $return_string .= '<h3 class="osLight">' . esc_html($post->post_title) . '</h3>';
                $return_string .= '<div class="address">';
                if($address != '') {
                    $return_string .= esc_html($address) . ', ';
                }
                if($city != '') {
                    $return_string .= esc_html($city) . ', ';
                }
                $return_string .= esc_html($country);
                $return_string .= '</div></div>';
                $return_string .= '</a>';
                $return_string .= '</div>';
            endforeach;
            $return_string .= '</div>';
    
            wp_reset_postdata();
            wp_reset_query();
            return $return_string;
        }
    endif;
    
    /**
     * Featured agents shortcode
     */
    if( !function_exists('reales_featured_agents_shortcode') ):
        function reales_featured_agents_shortcode($attrs, $content = null) {
            extract(shortcode_atts(array(
                'title' => 'Our Agents'
            ), $attrs));
    
            if(isset($attrs['show']) && is_numeric($attrs['show'])) {
                $show = $attrs['show'];
            } else {
                $show = '4';
            }
    
            $args = array(
                    'posts_per_page'   => $show,
                    'post_type'        => 'agent',
                    'orderby'          => 'post_date',
                    'order'            => 'DESC',
                    'meta_key'         => 'agent_featured',
                    'meta_value'       => '1',
                    'post_status'      => 'publish' );
            $posts = get_posts($args);
    
            $return_string = '<h2 class="centered osLight">' . esc_html($title) . '</h2>';
            $return_string .= '<div class="row pb40">';
            foreach($posts as $post) : setup_postdata($post);
                $avatar = get_post_meta($post->ID, 'agent_avatar', true);
                if($avatar != '') {
                    $avatar_src = $avatar;
                } else {
                    $avatar_src = get_template_directory_uri().'/images/avatar.png';
                }
                $email = get_post_meta($post->ID, 'agent_email', true);
                $facebook = get_post_meta($post->ID, 'agent_facebook', true);
                $twitter = get_post_meta($post->ID, 'agent_twitter', true);
                $google = get_post_meta($post->ID, 'agent_google', true);
                $linkedin = get_post_meta($post->ID, 'agent_linkedin', true);
    
                if(intval($show) % 3 == 0) {
                    $return_string .= '<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4">';
                } else {
                    $return_string .= '<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3">';
                }
                $return_string .= '<div class="agent">';
                $return_string .= '<a href="' . esc_url(get_permalink($post->ID)) . '" class="agent-avatar">';
                $return_string .= '<img src="' . esc_url($avatar_src) . '" alt="' . esc_attr($post->post_title) . '">';
                $return_string .= '<div class="ring"></div>';
                $return_string .= '</a>';
                $return_string .= '<div class="agent-name osLight">' . esc_html($post->post_title) . '</div>';
                $return_string .= '<div class="agent-contact">';
                $return_string .= '<a href="' . esc_url(get_permalink($post->ID)) . '" class="btn btn-sm btn-icon btn-round btn-o btn-green"><span class="fa fa-link"></span></a> ';
                if($facebook && $facebook != '') {
                    $return_string .= '<a href="' . esc_url($facebook) . '" class="btn btn-sm btn-icon btn-round btn-o btn-facebook" target="_blank"><span class="fa fa-facebook"></span></a> ';
                }
                if($twitter && $twitter != '') {
                    $return_string .= '<a href="' . esc_url($twitter) . '" class="btn btn-sm btn-icon btn-round btn-o btn-twitter" target="_blank"><span class="fa fa-twitter"></span></a> ';
                }
                if($google && $google != '') {
                    $return_string .= '<a href="' . esc_url($google) . '" class="btn btn-sm btn-icon btn-round btn-o btn-google" target="_blank"><span class="fa fa-google-plus"></span></a> ';
                }
                if($linkedin && $linkedin != '') {
                    $return_string .= '<a href="' . esc_url($linkedin) . '" class="btn btn-sm btn-icon btn-round btn-o btn-linkedin" target="_blank"><span class="fa fa-linkedin"></span></a>';
                }
                $return_string .= '</div>';
                $return_string .= '</div>';
                $return_string .= '</div>';
            endforeach;
            $return_string .= '</div>';
    
            wp_reset_postdata();
            wp_reset_query();
            return $return_string;
        }
    endif;
    
    /**
     * Testimonials shortcode
     */
    if( !function_exists('reales_testimonials_shortcode') ):
        function reales_testimonials_shortcode($attrs, $content = null) {
            extract(shortcode_atts(array(
                'title' => 'Testimonials'
            ), $attrs));
    
            $args = array(
                    'posts_per_page'   => 4,
                    'post_type'        => 'testimonials',
                    'orderby'          => 'post_date',
                    'order'            => 'DESC',
                    'post_status'      => 'publish' );
            $posts = get_posts($args);
    
            $return_string = '<h2 class="centered osLight">' . esc_html($title) . '</h2>';
            $return_string .= '<div class="row pb40">';
            $return_string .= '<div id="home-testimonials" class="carousel slide carousel-wb mb20" data-ride="carousel">';
            $return_string .= '<ol class="carousel-indicators">';
            for($i = 0; $i < count($posts); $i++) {
                $return_string .= '<li data-target="#home-testimonials" data-slide-to="' . esc_attr($i) . '"';
                if($i == 0) $return_string .= 'class="active"';
                $return_string .= ' ></li>';
            }
            $return_string .= '</ol>';
            $return_string .= '<div class="carousel-inner">';
            $counter = 0;
            foreach($posts as $post) : setup_postdata($post);
                $avatar = get_post_meta($post->ID, 'testimonials_avatar', true);
                if($avatar != '') {
                    $avatar_src = $avatar;
                } else {
                    $avatar_src = get_template_directory_uri().'/images/avatar.png';
                }
                $text = get_post_meta($post->ID, 'testimonials_text', true);
    
                $return_string .= '<div class="item';
                if($counter == 0) $return_string .= ' active';
                $return_string .= '">';
                $return_string .= '<img src="' . esc_url($avatar_src) . '" class="home-testim-avatar" alt="' . esc_attr($post->post_title) . '">';
                $return_string .= '<div class="home-testim">';
                $return_string .= '<div class="home-testim-text">' . esc_html($text) . '</div>';
                $return_string .= '<div class="home-testim-name">' . esc_html($post->post_title) . '</div>';
                $return_string .= '</div>';
                $return_string .= '</div>';
                $counter++;
            endforeach;
            $return_string .= '</div>';
            $return_string .= '</div>';
            $return_string .= '</div>';
    
            wp_reset_postdata();
            wp_reset_query();
            return $return_string;
        }
    endif;
    
    /**
     * Latest blog posts shortcode
     */
    if( !function_exists('reales_latest_posts_shortcode') ):
        function reales_latest_posts_shortcode($attrs, $content = null) {
            extract(shortcode_atts(array(
                'title' => 'Recently Listed Properties'
            ), $attrs));
    
            if(isset($attrs['show']) && is_numeric($attrs['show'])) {
                $show = $attrs['show'];
            } else {
                $show = '4';
            }
    
            $args = array(
                'numberposts'   => $show,
                'post_type'     => 'post',
                'orderby'       => 'post_date',
                'order'         => 'DESC',
                'post_status'   => 'publish');
            $posts = wp_get_recent_posts($args, OBJECT);
    
            $return_string = '<h2 class="centered osLight">' . esc_html($title) . '</h2>';
            $return_string .= '<div class="row pb40">';
    
            foreach($posts as $post) :
                if(intval($show) % 3 == 0) {
                    $return_string .= '<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">';
                } else {
                    $return_string .= '<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3">';
                }
                $return_string .= '<div class="article bg-w">';
    
                $post_link = get_permalink($post->ID);
                $post_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
    
                $return_string .= '<a href="' . esc_url($post_link) . '" class="image">';
                $return_string .= '<div class="img" style="background-image: url(' . esc_url($post_image[0]) . ')"></div>';
                $return_string .= '</a>';
                $return_string .= '<div class="article-category">';
    
                $categories = get_the_category($post->ID);
                $separator = ' ';
                $output = '';
                if($categories) {
                    foreach($categories as $category) {
                        $output .= '<a class="text-green" href="' . esc_url(get_category_link( $category->term_id )) . '" title="' . esc_attr( sprintf( __( "View all posts in %s", 'reales' ), $category->name ) ) . '">' . esc_html($category->cat_name) . '</a>' . esc_html($separator);
                    }
                    $return_string .= trim($output, $separator);
                }
    
                $return_string .= '</div>';
                $return_string .= '<h3><a href="' . esc_url($post_link) . '">' . esc_html($post->post_title) . '</a></h3>';
    
                $post_author = get_the_author_meta( 'display_name' , $post->post_author );
                $post_date = get_the_date('F j, Y',$post->ID);
    
                $return_string .= '<div class="footer">' . esc_html($post_author) . ', ' . esc_html($post_date) . '</div>';
                $return_string .= '</div>';
                $return_string .= '</div>';
            endforeach;
    
            $return_string .= '</div>';
    
            wp_reset_postdata();
            wp_reset_query();
            return $return_string;
        }
    endif;
    
    /**
     * Featured blog posts shortcode
     */
    if( !function_exists('reales_featured_posts_shortcode') ):
        function reales_featured_posts_shortcode($attrs, $content = null) {
            extract(shortcode_atts(array(
                'title' => 'Featured Listed Properties'
            ), $attrs));
    
            if(isset($attrs['show']) && is_numeric($attrs['show'])) {
                $show = $attrs['show'];
            } else {
                $show = '4';
            }
    
            $args = array(
                'numberposts'   => $show,
                'post_type'     => 'post',
                'orderby'       => 'post_date',
                'meta_key'      => 'post_featured',
                'meta_value'    => '1',
                'order'         => 'DESC',
                'post_status'   => 'publish');
            $posts = wp_get_recent_posts($args, OBJECT);
    
            $return_string = '<h2 class="centered osLight">' . esc_html($title) . '</h2>';
            $return_string .= '<div class="row pb40">';
    
            foreach($posts as $post) :
                if(intval($show) % 3 == 0) {
                    $return_string .= '<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">';
                } else {
                    $return_string .= '<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3">';
                }
                $return_string .= '<div class="article bg-w">';
    
                $post_link = get_permalink($post->ID);
                $post_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
    
                $return_string .= '<a href="' . esc_url($post_link) . '" class="image">';
                $return_string .= '<div class="img" style="background-image: url(' . esc_url($post_image[0]) . ')"></div>';
                $return_string .= '</a>';
                $return_string .= '<div class="article-category">';
    
                $categories = get_the_category($post->ID);
                $separator = ' ';
                $output = '';
                if($categories) {
                    foreach($categories as $category) {
                        $output .= '<a class="text-green" href="' . esc_url(get_category_link( $category->term_id )) . '" title="' . esc_attr( sprintf( __( "View all posts in %s", 'reales' ), $category->name ) ) . '">' . esc_html($category->cat_name) . '</a>' . esc_html($separator);
                    }
                    $return_string .= trim($output, $separator);
                }
    
                $return_string .= '</div>';
                $return_string .= '<h3><a href="' . esc_url($post_link) . '">' . esc_html($post->post_title) . '</a></h3>';
    
                $post_author = get_the_author_meta( 'display_name' , $post->post_author );
                $post_date = get_the_date('F j, Y',$post->ID);
    
                $return_string .= '<div class="footer">' . esc_html($post_author) . ', ' . esc_html($post_date) . '</div>';
                $return_string .= '</div>';
                $return_string .= '</div>';
            endforeach;
    
            $return_string .= '</div>';
    
            wp_reset_postdata();
            wp_reset_query();
            return $return_string;
        }
    endif;
    
    /**
     * Columns shortcode
     */
    if( !function_exists('reales_column_shortcode') ):
        function reales_column_shortcode($attrs, $content = null) {
            extract(shortcode_atts(array(
                'type' => '',
            ), $attrs));
    
            $return_string = '';
    
            switch($type) {
                case 'one_half':
                    $return_string .= '<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 pb20">' . $content . '</div>';
                    break;
                case 'one_half_last':
                    $return_string .= '<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 pb20">' . $content . '</div>';
                    $return_string .= '<div class="clearfix"></div>';
                    break;
                case 'one_third':
                    $return_string .= '<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4 pb20">' . $content . '</div>';
                    break;
                case 'one_third_last':
                    $return_string .= '<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4 pb20">' . $content . '</div>';
                    $return_string .= '<div class="clearfix"></div>';
                    break;
                case 'one_fourth':
                    $return_string .= '<div class="col-xs-12 col-sm-12 col-md-3 col-lg-3 pb20">' . $content . '</div>';
                    break;
                case 'one_fourth_last':
                    $return_string .= '<div class="col-xs-12 col-sm-12 col-md-3 col-lg-3 pb20">' . $content . '</div>';
                    $return_string .= '<div class="clearfix"></div>';
                    break;
                case 'two_third':
                    $return_string .= '<div class="col-xs-12 col-sm-12 col-md-8 col-lg-8 pb20">' . $content . '</div>';
                    break;
                case 'two_third_last':
                    $return_string .= '<div class="col-xs-12 col-sm-12 col-md-8 col-lg-8 pb20">' . $content . '</div>';
                    $return_string .= '<div class="clearfix"></div>';
                    break;
                case 'three_fourth':
                    $return_string .= '<div class="col-xs-12 col-sm-12 col-md-9 col-lg-9 pb20">' . $content . '</div>';
                    break;
                case 'three_fourth_last':
                    $return_string .= '<div class="col-xs-12 col-sm-12 col-md-9 col-lg-9 pb20">' . $content . '</div>';
                    $return_string .= '<div class="clearfix"></div>';
                    break;
            }
    
            wp_reset_query();
            return $return_string;
        }
    endif;
    
    /**
     *****************************************************************************
     * Custom post types
     *****************************************************************************
     */
    
    /**
     * Register property custom post type
     */
    if( !function_exists('reales_register_property_type_init') ):
        function reales_register_property_type_init() {
            wp_enqueue_style('reales_plugin_style', plugins_url( '/css/style.css', __FILE__ ), false, '1.0', 'all');
            wp_enqueue_style('datepicker_style', plugins_url( '/css/datepicker.css', __FILE__ ), false, '1.0', 'all');
            wp_enqueue_script('gmaps', 'https://maps.googleapis.com/maps/api/js?sensor=true&libraries=geometry&libraries=places', array('jquery'), '1.0', true);
            wp_enqueue_script('boostrap-datepicker', plugins_url( '/js/bootstrap-datepicker.js', __FILE__ ), false, '1.0', true);
            wp_enqueue_script('property', plugins_url( '/js/property.js', __FILE__ ), false, '1.0', true);
    
            wp_localize_script('property', 'property_vars',
                array('admin_url' => get_admin_url(),
                      'theme_url' => get_template_directory_uri(),
                      'plugins_url' => plugins_url( '/images/', __FILE__ ),
                      'browse_text' => __('Browse...', 'reales'),
                      'delete_photo' => __('Delete', 'reales')
                )
            );
        }
    endif;
    add_action('init', 'reales_register_property_type_init');
    
    if( !function_exists('reales_register_property_type') ):
        function reales_register_property_type() {
            register_post_type('property', array(
                'labels' => array(
                    'name'                  => __('Properties','reales'),
                    'singular_name'         => __('Property','reales'),
                    'add_new'               => __('Add New Property','reales'),
                    'add_new_item'          => __('Add Property','reales'),
                    'edit'                  => __('Edit','reales'),
                    'edit_item'             => __('Edit Property','reales'),
                    'new_item'              => __('New Property','reales'),
                    'view'                  => __('View','reales'),
                    'view_item'             => __('View Property','reales'),
                    'search_items'          => __('Search Properties','reales'),
                    'not_found'             => __('No Properties found','reales'),
                    'not_found_in_trash'    => __('No Properties found in Trash','reales'),
                    'parent'                => __('Parent Property', 'reales'),
                ),
                'public'                => true,
                'exclude_from_search '  => false,
                'has_archive'           => true,
                'rewrite'               => array('slug' => 'properties'),
                'supports'              => array('title', 'editor', 'thumbnail', 'comments'),
                'can_export'            => true,
                'register_meta_box_cb'  => 'reales_add_property_metaboxes',
                'menu_icon'             => plugins_url( '/images/property-icon.png', __FILE__ )
            ));
    
            // add property category custom taxonomy (e.g. apartments/houses)
            register_taxonomy('property_category', 'property', array(
                'labels' => array(
                    'name'              => __('Property Categories','reales'),
                    'add_new_item'      => __('Add New Property Category','reales'),
                    'new_item_name'     => __('New Property Category','reales')
                ),
                'hierarchical'  => true,
                'query_var'     => true,
                'rewrite'       => array('slug' => 'listings')
            ));
    
            // add property type custom taxonomy (e.g. for rent/for sale)
            register_taxonomy('property_type_category', 'property', array(
                'labels' => array(
                    'name'              => __('Property Types','reales'),
                    'add_new_item'      => __('Add New Property Type','reales'),
                    'new_item_name'     => __('New Property Type','reales')
                ),
                'hierarchical'  => true,
                'query_var'     => true,
                'rewrite'       => array('slug' => 'type')
            ));
        }
    endif;
    add_action('init', 'reales_register_property_type');
    
    if( !function_exists('reales_insert_default_terms') ):
        function reales_insert_default_terms() {
            reales_register_property_type();
            wp_insert_term('Apartment', 'property_category', $args = array());
            wp_insert_term('House', 'property_category', $args = array());
            wp_insert_term('Land', 'property_category', $args = array());
            wp_insert_term('For Rent', 'property_type_category', $args = array());
            wp_insert_term('For Sale', 'property_type_category', $args = array());
        }
    endif;
    register_activation_hook( __FILE__, 'reales_insert_default_terms' );
    
    /**
     * Add property post type metaboxes
     */
    if( !function_exists('reales_add_property_metaboxes') ):
        function reales_add_property_metaboxes() {
            add_meta_box('property-location-section', __('Location', 'reales'), 'reales_property_location_render', 'property', 'normal', 'default');
            add_meta_box('property-details-section', __('Details', 'reales'), 'reales_property_details_render', 'property', 'normal', 'default');
            add_meta_box('property-additional-section', __('Additional Information', 'reales'), 'reales_property_additional_render', 'property', 'normal', 'default');
            add_meta_box('property-amenities-section', __('Amenities', 'reales'), 'reales_property_amenities_render', 'property', 'normal', 'default');
            add_meta_box('property-plans-section', __('Floor Plans', 'reales'), 'reales_property_plans_render', 'property', 'normal', 'default');
            add_meta_box('property-agent-section', __('Agent', 'reales'), 'reales_property_agent_render', 'property', 'normal', 'default');
            add_meta_box('property-video-section', __('Video', 'reales'), 'reales_property_video_render', 'property', 'normal', 'default');
            add_meta_box('property-gallery-section', __('Photo Gallery', 'reales'), 'reales_property_gallery_render', 'property', 'normal', 'default');
            add_meta_box('property-featured-section', __('Featured', 'reales'), 'reales_property_featured_render', 'property', 'side', 'default');
        }
    endif;
    
    if( !function_exists('reales_property_location_render') ):
        function reales_property_location_render($post) {
            wp_nonce_field(plugin_basename(__FILE__), 'property_noncename');
    
            print '
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td width="33%" valign="top" align="left">
                            <div class="adminField">
                                <label for="property_city">' . __('City', 'reales') . '</label><br />
                                <input type="text" class="formInput" id="property_city" name="property_city" placeholder="' . __('Enter a city name', 'reales') . '" value="' . esc_attr(get_post_meta($post->ID, 'property_city', true)) . '" />
                            </div>
                        </td>
                        <td width="33%" valign="top" align="left">
                            <div class="adminField">
                                <label for="property_lat">' . __('Latitude', 'reales') . '</label><br />
                                <input type="text" class="formInput" id="property_lat" name="property_lat" value="' . esc_attr(get_post_meta($post->ID, 'property_lat', true)) . '" />
                            </div>
                        </td>
                        <td width="33%" valign="top" align="left">
                            <div class="adminField">
                                <label for="property_lng">' . __('Longitude', 'reales') . '</label><br />
                                <input type="text" class="formInput" id="property_lng" name="property_lng" value="' . esc_attr(get_post_meta($post->ID, 'property_lng', true)) . '" />
                            </div>
                        </td>
                    </tr>
                </table>
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td width="100%" valign="top" align="left">
                            <div id="propMapView"></div>
                        </td>
                    </tr>
                </table>
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td width="33%" valign="top" align="left">
                            <div class="adminField">
                                <label for="property_address">' . __('Address', 'reales') . '</label><br />
                                <input type="text" class="formInput" id="property_address" name="property_address" placeholder="' . __('Enter address', 'reales') . '" value="' . esc_attr(get_post_meta($post->ID, 'property_address', true)) . '" />
                                <input id="placePinBtn" type="button" class="button" value="' . __('Place pin by address', 'reales') . '">
                            </div>
                        </td>
                        <td width="33%" valign="top" align="left">
                            <div class="adminField">
                                <label for="property_state">' . __('County/State', 'reales') . '</label><br />
                                <input type="text" class="formInput" id="property_state" name="property_state" placeholder="' . __('Enter county/state', 'reales') . '" value="' . esc_attr(get_post_meta($post->ID, 'property_state', true)) . '" />
                            </div>
                        </td>
                        <td width="33%" valign="top" align="left">
                            <div class="adminField">
                                <label for="property_state">' . __('Neighborhood', 'reales') . '</label><br />
                                <input type="text" class="formInput" id="property_neighborhood" name="property_neighborhood" placeholder="' . __('Enter neighborhood', 'reales') . '" value="' . esc_attr(get_post_meta($post->ID, 'property_neighborhood', true)) . '" />
                            </div>
                        </td>
                    </tr>
                </table>
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td width="33%" valign="top" align="left">
                            <div class="adminField">
                                <label for="property_zip">' . __('Zip Code', 'reales') . '</label><br />
                                <input type="text" class="formInput" id="property_zip" name="property_zip" placeholder="' . __('Enter zip code', 'reales') . '" value="' . esc_attr(get_post_meta($post->ID, 'property_zip', true)) . '" />
                            </div>
                        </td>
                        <td width="33%" valign="top" align="left">
                            <div class="adminField">
                                <label for="property_country">' . __('Country', 'reales') . '</label><br />';
                                print reales_country_list(esc_html(get_post_meta($post->ID, 'property_country', true)));
                                print '
                            </div>
                        </td>
                        <td width="33%" valign="top" align="left">&nbsp;</td>
                    </tr>
                </table>';
        }
    endif;
    
    if( !function_exists('reales_property_details_render') ):
        function reales_property_details_render($post) {
            wp_nonce_field(plugin_basename(__FILE__), 'property_noncename');
            $reales_general_settings = get_option('reales_general_settings');
    
            $price = (esc_html(get_post_meta($post->ID, 'property_price', true)) != '') ? esc_html(get_post_meta($post->ID, 'property_price', true)) : 0;
            $currency_symbol = isset($reales_general_settings['reales_currency_symbol_field']) ? $reales_general_settings['reales_currency_symbol_field'] : '';
            $unit = isset($reales_general_settings['reales_unit_field']) ? $reales_general_settings['reales_unit_field'] : '';
    
            print '
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td width="33%" valign="top" align="left">
                            <div class="adminField">
                                <label for="property_price">' . __('Price', 'reales') . ' (' . esc_html($currency_symbol) . ')' . '</label><br />
                                <input type="text" class="formInput" id="property_price" name="property_price" placeholder="' . __('Enter price', 'reales') . '" value="' . esc_attr($price) . '" />
                            </div>
                        </td>
                        <td width="33%" valign="top" align="left">
                            <div class="adminField">
                                <label for="property_price_label">' . __('Price Label (e.g. "per month")', 'reales') . '</label><br />
                                <input type="text" class="formInput" id="property_price_label" name="property_price_label" placeholder="' . __('Enter price label', 'reales') . '" value="' . esc_attr(get_post_meta($post->ID, 'property_price_label', true)) . '" />
                            </div>
                        </td>
                        <td width="33%" valign="top" align="left">
                            <div class="adminField">
                                <label for="property_area">' . __('Area', 'reales') . ' (' . esc_html($unit) . ')' . '</label><br />
                                <input type="text" class="formInput" id="property_area" name="property_area" placeholder="' . __('Enter area', 'reales') . '" value="' . esc_attr(get_post_meta($post->ID, 'property_area', true)) . '" />
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td width="33%" valign="top" align="left">
                            <div class="adminField">
                                <label for="property_bedrooms">' . __('Bedrooms', 'reales') . '</label><br />
                                <input type="text" class="formInput" id="property_bedrooms" name="property_bedrooms" placeholder="' . __('Enter number of bedrooms', 'reales') . '" value="' . esc_attr(get_post_meta($post->ID, 'property_bedrooms', true)) . '" />
                            </div>
                        </td>
                        <td width="33%" valign="top" align="left">
                            <div class="adminField">
                                <label for="property_bathrooms">' . __('Bathrooms', 'reales') . '</label><br />
                                <input type="text" class="formInput" id="property_bathrooms" name="property_bathrooms" placeholder="' . __('Enter number of bathrooms', 'reales') . '" value="' . esc_attr(get_post_meta($post->ID, 'property_bathrooms', true)) . '" />
                            </div>
                        </td>
                        <td width="33%" valign="top" align="left">&nbsp;</td>
                    </tr>
                </table>';
        }
    endif;
    
    if( !function_exists('reales_property_additional_render') ):
        function reales_prop
Viendo 1 respuesta (de un total de 1)
  • Una solución es que, ya que el plugin permite sobrescribir las funciones, construirte un pequeño plugin que en su functions.php modifique la función en cuestión (o hacerlo en el functions.php del theme, aunque esto yo no lo recomiendo), y que se cargue con prioridad mayor que la del plugin del tema.

    Como no nos indicas cual es el shortcode, te pongo un ejemplo. Supongamos que la función fuera la que pongo

    /**
     * Testimonials shortcode
     */
    if( !function_exists('reales_testimonials_shortcode') ):
        function reales_testimonials_shortcode($attrs, $content = null) {
            extract(shortcode_atts(array(
                'title' => 'Testimonials'
            ), $attrs));
          [.....]
    
          return $return_string
        }
    endif

    Pues simplemente en tu código, pones exactamente ese mismo cacho de código y lo modificas a tu gusto.

    Por prioridad, tu plugin cargaría antes que el plugin del tema, y por tanto, habría definido la función tuya antes que la del plugin. Como está indicado la carga condicional, pues se ejecutaría tu función

Viendo 1 respuesta (de un total de 1)
  • El debate ‘Crear campo en backend con ACF’ está cerrado a nuevas respuestas.