Ejemplo n.º 1
0
 $acf_field_position = array_search($search_field, tt_acf_fields_name(tt_acf_group_id_property()));
 $acf_field_type_key = tt_acf_fields_type(tt_acf_group_id_property());
 $acf_field_type = $acf_field_type_key[$acf_field_position];
 // Single value based ACF fields, that appear next to default fields. Arrays such as checkboxes & radio buttons are shown under "more".
 // $acf_supported_field_types = array( 'text', 'number', 'email', 'date_picker', 'select' );
 //if ( in_array( $acf_field_type, $acf_supported_field_types ) ) {
 echo '<div class="' . $columns . ' form-group">';
 //}
 // Field Type: Select, Checkbox
 if ($acf_field_type == 'select' || $acf_field_type == 'checkbox' || $acf_field_type == 'radio') {
     $acf_custom_keys = get_post_custom_keys(tt_acf_group_id_property());
     $acf_object = get_field_object($search_field);
     // ACF: Loop through field keys, as we can't output choices by name, but only by their key
     foreach ($acf_custom_keys as $key => $value) {
         if (stristr($value, 'field_')) {
             $acf_field = get_field_object($value, tt_acf_group_id_property());
             if ($acf_field['name'] == $search_field) {
                 // Select
                 if ($acf_field_type == 'select') {
                     echo '<select name="' . $acf_field['name'] . '" data-placeholder="' . __($search_labels[$i], 'tt') . '">';
                     echo '<option value=""></option>';
                     foreach ($acf_field['choices'] as $key => $value) {
                         // Default value
                         if ($acf_object['value'] == $key) {
                             $selected = "selected";
                         } else {
                             $selected = "";
                         }
                         echo '<option value="' . $key . '" ' . $selected . '>' . $value . '</option>';
                     }
                     echo '</select>';
Ejemplo n.º 2
0
		
		<?php 
if (tt_acf_active() && tt_acf_group_id_property()) {
    // Check if ACF plugin is active & for post type "property" field group
    ?>
		<section id="additional-details">
			<?php 
    if ($property_title_additional_details) {
        echo '<h3 class="section-title"><span>' . __($property_title_additional_details, 'tt') . '</span></h3>';
    }
    ?>
			<ul class="list-unstyled row">
			<?php 
    $acf_fields_name = tt_acf_fields_name(tt_acf_group_id_property());
    $acf_fields_label = tt_acf_fields_label(tt_acf_group_id_property());
    $acf_fields_type = tt_acf_fields_type(tt_acf_group_id_property());
    $acf_fields_count = count($acf_fields_name);
    $i = 0;
    while ($acf_fields_count > $i) {
        wp_reset_postdata();
        $field = get_field($acf_fields_name[$i]);
        if ($field == '') {
            $field = '-';
            $empty_field = true;
        }
        if (!$hide_sidebar && is_active_sidebar('sidebar_property')) {
            $output = '<li class="col-sm-6 col-md-4">';
        } else {
            $output = '<li class="col-sm-4 col-md-3">';
        }
        $output .= '<strong>' . __($acf_fields_label[$i], 'tt') . ':</strong> ';
Ejemplo n.º 3
0
        public function setSections()
        {
            /**
             * Used within different fields. Simply examples. Search for ACTUAL DECLARATION for field examples
             * */
            // Background Patterns Reader
            $sample_patterns_path = ReduxFramework::$_dir . '../sample/patterns/';
            $sample_patterns_url = ReduxFramework::$_url . '../sample/patterns/';
            $sample_patterns = array();
            if (is_dir($sample_patterns_path)) {
                if ($sample_patterns_dir = opendir($sample_patterns_path)) {
                    $sample_patterns = array();
                    while (($sample_patterns_file = readdir($sample_patterns_dir)) !== false) {
                        if (stristr($sample_patterns_file, '.png') !== false || stristr($sample_patterns_file, '.jpg') !== false) {
                            $name = explode('.', $sample_patterns_file);
                            $name = str_replace('.' . end($name), '', $sample_patterns_file);
                            $sample_patterns[] = array('alt' => $name, 'img' => $sample_patterns_url . $sample_patterns_file);
                        }
                    }
                }
            }
            ob_start();
            $ct = wp_get_theme();
            $this->theme = $ct;
            $item_name = $this->theme->get('Name');
            $tags = $this->theme->Tags;
            $screenshot = $this->theme->get_screenshot();
            $class = $screenshot ? 'has-screenshot' : '';
            $customize_title = sprintf(__('Customize &#8220;%s&#8221;', 'tt'), $this->theme->display('Name'));
            ?>
                <div id="current-theme" class="<?php 
            echo esc_attr($class);
            ?>
">
                    <?php 
            if ($screenshot) {
                ?>
                        <?php 
                if (current_user_can('edit_theme_options')) {
                    ?>
                            <a href="<?php 
                    echo wp_customize_url();
                    ?>
" class="load-customize hide-if-no-customize"
                               title="<?php 
                    echo esc_attr($customize_title);
                    ?>
">
                                <img src="<?php 
                    echo esc_url($screenshot);
                    ?>
"
                                     alt="<?php 
                    esc_attr_e('Current theme preview', 'tt');
                    ?>
"/>
                            </a>
                        <?php 
                }
                ?>
                        <img class="hide-if-customize" src="<?php 
                echo esc_url($screenshot);
                ?>
"
                             alt="<?php 
                esc_attr_e('Current theme preview', 'tt');
                ?>
"/>
                    <?php 
            }
            ?>

                    <h4><?php 
            echo $this->theme->display('Name');
            ?>
</h4>

                    <div>
                        <ul class="theme-info">
                            <li><?php 
            printf(__('By %s', 'tt'), $this->theme->display('Author'));
            ?>
</li>
                            <li><?php 
            printf(__('Version %s', 'tt'), $this->theme->display('Version'));
            ?>
</li>
                            <li><?php 
            echo '<strong>' . __('Tags', 'tt') . ':</strong> ';
            printf($this->theme->display('Tags'));
            ?>
</li>
                        </ul>
                        <p class="theme-description"><?php 
            echo $this->theme->display('Description');
            ?>
</p>
                        <?php 
            if ($this->theme->parent()) {
                printf(' <p class="howto">' . __('This <a href="%1$s">child theme</a> requires its parent theme, %2$s.', 'tt') . '</p>', __('http://codex.wordpress.org/Child_Themes', 'tt'), $this->theme->parent()->display('Name'));
            }
            ?>

                    </div>
                </div>

                <?php 
            $item_info = ob_get_contents();
            ob_end_clean();
            $sampleHTML = '';
            if (file_exists(dirname(__FILE__) . '/info-html.html')) {
                Redux_Functions::initWpFilesystem();
                global $wp_filesystem;
                $sampleHTML = $wp_filesystem->get_contents(dirname(__FILE__) . '/info-html.html');
            }
            /* General
            			============================== */
            $this->sections[] = array('title' => __('General', 'tt'), 'desc' => __('', 'tt'), 'icon' => 'fa fa-cog', 'fields' => array(array('id' => 'color-body-background', 'type' => 'background', 'output' => array('body, .section-title span'), 'title' => __('Body Background Color', 'tt'), 'subtitle' => __('Site Background Color (default: #f8f8f8)', 'tt'), 'default' => array('background-color' => '#f8f8f8'), 'background-repeat' => false, 'background-attachment' => false, 'background-position' => false, 'background-image' => false, 'transparent' => false, 'background-size' => false), array('id' => 'color-accent', 'type' => 'color', 'title' => __('Accent Color', 'tt'), 'subtitle' => __('Site Background Color (default: #70b9a0)', 'tt'), 'default' => '#70b9a0', 'validate' => 'color', 'transparent' => false), array('id' => 'favicon', 'type' => 'media', 'title' => __('Favicon', 'tt'), 'compiler' => 'true', 'mode' => false, 'desc' => __('Upload Square Graphic (Recommendation: 64x64 PNG file)', 'tt'), 'subtitle' => __('', 'tt')), array('id' => 'logo-menu', 'type' => 'media', 'title' => __('Logo', 'tt'), 'compiler' => 'true', 'mode' => false, 'desc' => __('Image will be displayed at 50% width & height for Retina-Ready purpose. For example: 300x60 image shows at 150x30. Upload your logo accordingly.', 'tt'), 'subtitle' => __('', 'tt')), array('id' => 'logo-url', 'type' => 'text', 'title' => __('Logo URL', 'tt'), 'desc' => __('Helpful when using intro page as your frontpage. If empty, URL will be your site address.', 'tt'), 'subtitle' => __('', 'tt')), array('id' => 'logo-login', 'type' => 'media', 'title' => __('WordPress Login Page - Logo', 'tt'), 'compiler' => 'true', 'mode' => false, 'desc' => __('Max. dimension: 320x80', 'tt'), 'subtitle' => __('', 'tt')), array('id' => 'background-login', 'type' => 'color', 'title' => __('WordPress Login Page - Background Color', 'tt'), 'subtitle' => __('Default: #f8f8f8', 'tt'), 'default' => '#f8f8f8', 'validate' => 'color', 'transparent' => false), array('id' => '404-page', 'type' => 'select', 'data' => 'pages', 'title' => __('Custom 404 Error Page', 'tt'), 'subtitle' => __('Content of selected page will be shown to visitors who request a non-existing, so called "404 Error Page".', 'tt'), 'desc' => __('If nothing selected, default 404 Content will be displayed.', 'tt')), array('id' => 'custom-styles', 'type' => 'ace_editor', 'mode' => 'css', 'theme' => 'chrome', 'title' => __('Custom Styles (CSS)', 'tt'), 'subtitle' => __('Inline CSS right before closing <strong>&lt;/head&gt;</strong>', 'tt'), 'desc' => __('', 'tt'), 'default' => ''), array('id' => 'custom-scripts', 'type' => 'ace_editor', 'mode' => 'javascript', 'theme' => 'chrome', 'title' => __('Custom Scripts (Google Analytics etc.)', 'tt'), 'subtitle' => __('Inline scripts right before closing <strong>&lt;/body&gt;</strong>', 'tt'), 'desc' => __('Use "jQuery" selector, instead of "$" shorthand. Do not add any &lt;script&gt; tags, they are already applied to this code.', 'tt'), 'default' => ''), array('id' => 'enable-rtl-support', 'type' => 'checkbox', 'title' => __('Enable Right-to-Left Language Support', 'tt'), 'subtitle' => __('Required for carousel etc.', 'tt'), 'desc' => __('', 'tt'), 'default' => 0), array('id' => 'user-registration-terms-page', 'type' => 'select', 'data' => 'pages', 'title' => __('User Registration: Select "Terms & Conditions" Page', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('Select the page that contains your "Terms & Conditions". When a page has been selected, users are required to accept your terms and conditions in order to register.', 'tt'))));
            /* HEADER
            			============================== */
            $this->sections[] = array('title' => __('Header', 'tt'), 'desc' => __('', 'tt'), 'icon' => 'fa fa-bars', 'fields' => array(array('id' => 'header-layout', 'type' => 'radio', 'title' => __('Header Layout', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'options' => array('default' => __('Logo left, contact right, navigation bottom', 'tt'), 'nav-right' => __('Logo left, contact top , navigation right', 'tt')), 'default' => 'default'), array('id' => 'color-header-background', 'type' => 'background', 'output' => array('header.navbar, header.navbar .navbar-collapse, header.navbar .navbar-nav > ul > li ul.sub-menu, header.navbar nav > div > ul > li ul.sub-menu'), 'title' => __('Site Header Background Color', 'tt'), 'subtitle' => __('Site Background Color (default: #333333)', 'tt'), 'default' => array('background-color' => '#333333'), 'background-repeat' => false, 'background-attachment' => false, 'background-position' => false, 'background-image' => false, 'transparent' => false, 'background-size' => false), array('id' => 'color-header', 'type' => 'color', 'title' => __('Site Header Color', 'tt'), 'subtitle' => __('Site Header Color (default: #ffffff)', 'tt'), 'default' => '#ffffff', 'validate' => 'color', 'transparent' => false), array('id' => 'site-header-phone', 'type' => 'text', 'title' => __('Phone Number', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => '+1 555 22 66 8890'), array('id' => 'site-header-email', 'type' => 'text', 'title' => __('Email Address', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'validate' => 'email', 'default' => '*****@*****.**'), array('id' => 'show-sub-menu-by-default-on-mobile', 'type' => 'checkbox', 'title' => __('Show Sub Menu By Default On Mobile', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => 0), array('id' => 'disable-header-login-register-bar', 'type' => 'checkbox', 'title' => __('Disable Login/Register Bar', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => 0), array('id' => 'site-header-hide-property-submit-link', 'type' => 'checkbox', 'title' => __('Hide Property Submit Link', 'tt'), 'subtitle' => __('For Non-Logged-In Visitors', 'tt'), 'desc' => __('', 'tt'), 'default' => 0), array('id' => 'site-header-position-fixed', 'type' => 'checkbox', 'title' => __('Enable Fixed/Scrolling Header', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => 0), array('id' => 'header-tagline', 'type' => 'checkbox', 'title' => __('Show Site Tagline', 'tt'), 'subtitle' => __('Display "Settings  > General > Tagline" underneath logo', 'tt'), 'desc' => __('', 'tt'), 'default' => 0)));
            /* Home Slideshow
            			============================== */
            $this->sections[] = array('title' => __('Home Slideshow', 'tt'), 'desc' => __('', 'tt'), 'icon' => 'fa fa-image', 'fields' => array(array('id' => 'slideshow-width-type', 'type' => 'radio', 'title' => __('Slideshow Width', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('Applied to page template "Home - Slideshow" and "Property Slideshow". Select smaller dimension for faster page load time. Setting doesn\'t effect slideshow container width, image still stretches full width.', 'tt'), 'options' => array('full' => __('Original Image Ratio', 'tt'), 'thumbnail-1600' => __('1600px', 'tt') . ' (new thumbnail size in v1.6.2, if selected make sure to <a href="https://wordpress.org/plugins/regenerate-thumbnails/" target="_blank">regenarate thumbnails</a>)', 'thumbnail-1200' => __('1200px (Default)', 'tt')), 'default' => 'thumbnail-1200'), array('id' => 'home-slideshow-height-type', 'type' => 'radio', 'title' => __('Slideshow Height', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('Applied to page template "Home - Slideshow" and "Property Slideshow". When selecting "Original Image Ratio" make sure your images have a sufficient height on mobile devices. If not, please resize them accordingly.', 'tt'), 'options' => array('original' => __('Original Image Ratio', 'tt'), 'fullscreen' => __('Fullscreen (min. 400px for proper display on mobile)', 'tt'), 'custom' => __('Custom Height (min. 400px for proper display on mobile)', 'tt')), 'default' => 'fullscreen'), array('id' => 'home-slideshow-custom-height', 'type' => 'text', 'title' => __('Custom Slideshow Height', 'tt'), 'subtitle' => __('Default: 400', 'tt'), 'desc' => __('', 'tt'), 'validate' => 'numeric', 'default' => '400', 'required' => array('home-slideshow-height-type', '=', 'custom')), array('id' => 'home-slideshow-speed', 'type' => 'text', 'title' => __('Slideshow Speed (in ms)', 'tt'), 'subtitle' => __('Default: 5000', 'tt'), 'desc' => __('', 'tt'), 'validate' => 'numeric', 'default' => '5000'), array('id' => 'home-slideshow-type', 'type' => 'radio', 'title' => __('Home Slideshow Type', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'options' => array('slideshow-properties' => __('Property Slideshow', 'tt'), 'slideshow-custom' => __('Custom Content Slideshow', 'tt')), 'default' => 'slideshow-properties'), array('id' => 'home-slideshow-properties-mode', 'type' => 'radio', 'title' => __('Property Slideshow Type', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'options' => array('slideshow-properties-show-featured' => __('Show Featured Properties', 'tt'), 'slideshow-properties-show-latest' => __('Show Latest 3 Properties', 'tt'), 'slideshow-properties-show-selected' => __('Show Selected Properties', 'tt')), 'default' => 'slideshow-properties-show-latest', 'required' => array('home-slideshow-type', '=', 'slideshow-properties')), array('id' => 'home-property-slides', 'type' => 'select', 'data' => 'posts', 'args' => array('post_type' => 'property', 'posts_per_page' => -1), 'multi' => true, 'sortable' => true, 'title' => __('Property Slides', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('Select Slideshow Properties. Order Via Drag & Drop.', 'tt'), 'required' => array('home-slideshow-properties-mode', '=', 'slideshow-properties-show-selected')), array('id' => 'home-slides', 'type' => 'slides', 'title' => __('Custom Content Slides', 'tt'), 'subtitle' => __('Create Your Custom Home Slideshow.', 'tt'), 'desc' => __('', 'tt'), 'placeholder' => array('title' => __('This is a title', 'tt'), 'description' => __('Description Here', 'tt'), 'url' => __('Give us a link!', 'tt')), 'required' => array('home-slideshow-type', '=', 'slideshow-custom')), array('id' => 'home-slideshow-search', 'type' => 'radio', 'title' => __('Show Property Search Form', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'options' => array('none' => __('None', 'tt'), 'mini' => __('Mini Search', 'tt'), 'custom' => __('Custom Search (configure under "Property Search")', 'tt')), 'default' => 'none')));
            /* Map
            			============================== */
            $this->sections[] = array('title' => __('Map', 'tt'), 'desc' => __('', 'tt'), 'icon' => 'fa fa-map-marker', 'fields' => array(array('id' => 'map-height-type-home-search', 'type' => 'radio', 'title' => __('Map Height', 'tt'), 'subtitle' => __('Min. 400px for proper display on mobile', 'tt'), 'desc' => __('Will be applied to home map and search results map.', 'tt'), 'options' => array('fullscreen' => __('Fullscreen', 'tt'), 'custom' => __('Custom Height', 'tt')), 'default' => 'custom'), array('id' => 'map-height-custom-home-search', 'type' => 'text', 'title' => __('Custom Map Height', 'tt'), 'subtitle' => __('Default: 400', 'tt'), 'desc' => __('', 'tt'), 'validate' => 'numeric', 'default' => '400', 'required' => array('map-height-type-home-search', '=', 'custom')), array('id' => 'map-marker-property-default', 'type' => 'image_select', 'title' => __('Default Map Marker: Property', 'tt'), 'subtitle' => __('Default: Green (Dimension: 100x138)', 'tt'), 'desc' => __('', 'tt'), 'options' => array(get_template_directory_uri() . '/lib/images/map-marker/map-marker-red-fat.png' => array('title' => 'Map Marker: Red', 'img' => get_template_directory_uri() . '/lib/images/map-marker/map-marker-red-fat.png'), get_template_directory_uri() . '/lib/images/map-marker/map-marker-blue-fat.png' => array('title' => 'Map Marker: Blue', 'img' => get_template_directory_uri() . '/lib/images/map-marker/map-marker-blue-fat.png'), get_template_directory_uri() . '/lib/images/map-marker/map-marker-green-fat.png' => array('title' => 'Map Marker: Green', 'img' => get_template_directory_uri() . '/lib/images/map-marker/map-marker-green-fat.png')), 'default' => get_template_directory_uri() . '/lib/images/map-marker/map-marker-green-fat.png'), array('id' => 'map-marker-property', 'type' => 'media', 'title' => __('Custom Map Marker: Property', 'tt'), 'compiler' => 'true', 'mode' => false, 'desc' => __('', 'tt'), 'subtitle' => __('Transparent PNG file (Recommended Dimension: 100x138)', 'tt')), array('id' => 'map-marker-cluster-default', 'type' => 'image_select', 'title' => __('Default Map Marker: Cluster', 'tt'), 'subtitle' => __('Default: Red (Dimension: 100x100)', 'tt'), 'desc' => __('', 'tt'), 'options' => array(get_template_directory_uri() . '/lib/images/map-marker/map-marker-red-round.png' => array('title' => 'Map Marker: Red', 'img' => get_template_directory_uri() . '/lib/images/map-marker/map-marker-red-round.png'), get_template_directory_uri() . '/lib/images/map-marker/map-marker-blue-round.png' => array('title' => 'Map Marker: Blue', 'img' => get_template_directory_uri() . '/lib/images/map-marker/map-marker-blue-round.png'), get_template_directory_uri() . '/lib/images/map-marker/map-marker-green-round.png' => array('title' => 'Map Marker: Green', 'img' => get_template_directory_uri() . '/lib/images/map-marker/map-marker-green-round.png')), 'default' => get_template_directory_uri() . '/lib/images/map-marker/map-marker-red-round.png'), array('id' => 'map-marker-cluster', 'type' => 'media', 'title' => __('Custom Map Marker: Cluster', 'tt'), 'compiler' => 'true', 'mode' => false, 'desc' => __('For a non-square graphic, you have to add some Custom CSS to position the cluster number: #map .cluster > div { line-height: 1 !important; padding-top: ??px !important; }', 'tt'), 'subtitle' => __('Transparent Square PNG file (Recommended Dimension: 100x100)', 'tt')), array('id' => 'map-default-zoom-level', 'type' => 'spinner', 'title' => __('Default Zoom Level', 'tt'), 'subtitle' => __('Default: 14', 'tt'), 'desc' => __('Applies to: Property Single Page.', 'tt'), 'default' => 14, 'min' => 1, 'step' => 1, 'max' => 20, 'display_value' => 'label'), array('id' => 'map-properties-quantity', 'type' => 'spinner', 'title' => __('Number of Properties on Map', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('Select "-1" to display all properties on the map.', 'tt'), 'default' => -1, 'min' => -1, 'step' => 1, 'max' => 100, 'display_value' => 'label'), array('id' => 'disable-google-maps-api', 'type' => 'checkbox', 'title' => __('Don\'t load Google Maps API', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('Check this box, if map is not showing. Another plugin might already load the API, and a duplicate API request produces an error.', 'tt'), 'default' => 0)));
            /* Property
            			============================== */
            // Default Fields
            $default_fields_search = array(__('Default Fields', 'tt') => array('estate_search_by_keyword' => __('Search by Keyword', 'tt'), 'estate_property_id' => __('Property ID', 'tt'), 'estate_property_location' => __('Location', 'tt'), 'estate_property_type' => __('Type', 'tt'), 'estate_property_status' => __('Status', 'tt'), 'estate_property_price' => __('Price', 'tt'), 'estate_property_pricerange' => __('Price Range (set options below)', 'tt'), 'estate_property_size' => __('Size', 'tt'), 'estate_property_rooms' => __('Rooms', 'tt'), 'estate_property_bedrooms' => __('Bedrooms', 'tt'), 'estate_property_bathrooms' => __('Bathrooms', 'tt'), 'estate_property_garages' => __('Garages', 'tt'), 'estate_property_available_from' => __('Availability / Date', 'tt')));
            // Default Property Listing Fields
            $default_fields_listing = array(__('Default Listing Fields', 'tt') => array('estate_property_id' => __('Property ID', 'tt'), 'estate_property_size' => __('Size', 'tt'), 'estate_property_rooms' => __('Rooms', 'tt'), 'estate_property_bedrooms' => __('Bedrooms', 'tt'), 'estate_property_bathrooms' => __('Bathrooms', 'tt'), 'estate_property_garages' => __('Garages', 'tt'), 'estate_property_available_from' => __('Availability / Date', 'tt')));
            require_once TT_LIB . '/advanced-custom-fields.php';
            // Check if ACF is activated & ACF for post type "property" field groups
            if (tt_acf_active() && tt_acf_group_id_property()) {
                $acf_fields = array_combine(tt_acf_fields_name(tt_acf_group_id_property()), tt_acf_fields_label(tt_acf_group_id_property()));
                $acf_fields = array(__('Advanced Custom Fields', 'tt') => $acf_fields);
                $merged_fields_search = array_merge($default_fields_search, $acf_fields);
                $merged_fields_listing = array_merge($default_fields_listing, $acf_fields);
            } else {
                $merged_fields_search = $default_fields_search;
                $merged_fields_listing = $default_fields_listing;
            }
            $this->sections[] = array('title' => __('Property', 'tt'), 'desc' => __('', 'tt'), 'icon' => 'fa fa-home', 'fields' => array(array('id' => 'section-property-listing', 'type' => 'section', 'title' => __('Property Listing', 'tt'), 'subtitle' => __('', 'tt')), array('id' => 'property-listing-type', 'type' => 'radio', 'title' => __('Property Listing Fields', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'options' => array('default' => __('Default', 'tt'), 'custom' => __('Custom', 'tt')), 'default' => 'default'), array('id' => 'property-custom-listing', 'type' => 'repeater', 'title' => __('Custom Listing Fields', 'tt'), 'subtitle' => __('FontAwesome icon classes, e.g. "fa-expand", can be found here: <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank">http://fortawesome.github.io/Font-Awesome/icons/</a>. Do not use Advanced Custom Fields with a type of "checkbox" etc., as only single values are accepted.', 'tt'), 'bind_title' => 'property-custom-listing-label', 'sortable' => true, 'required' => array('property-listing-type', '=', 'custom'), 'fields' => array(array('id' => 'property-custom-listing-field', 'title' => __('', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'type' => 'select', 'options' => $merged_fields_listing, 'placeholder' => __('Field Type', 'tt')), array('id' => 'property-custom-listing-icon-class', 'type' => 'text', 'placeholder' => __('FontAwesome Icon Class', 'tt')), array('id' => 'property-custom-listing-label', 'type' => 'text', 'placeholder' => __('Label', 'tt')), array('id' => 'property-custom-listing-label-plural', 'type' => 'text', 'placeholder' => __('Label Plural', 'tt')), array('id' => 'property-custom-listing-tooltip', 'type' => 'checkbox', 'subtitle' => __('Show Tooltip Only', 'tt'), 'default' => 0))), array('id' => 'property-listing-default-view', 'type' => 'radio', 'title' => __('Property Listing Default View', 'tt'), 'subtitle' => __('Default: Grid View', 'tt'), 'desc' => __('', 'tt'), 'options' => array('grid-view' => __('Grid View', 'tt'), 'list-view' => __('List View', 'tt')), 'default' => 'grid-view'), array('id' => 'property-listing-columns', 'type' => 'radio', 'title' => __('Number Of Columns', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'options' => array('col-md-6' => __('2 Columns', 'tt'), 'col-lg-4 col-md-6' => __('3 Columns', 'tt'), 'col-lg-3 col-md-6' => __('4 Columns', 'tt')), 'default' => 'col-lg-4 col-md-6'), array('id' => 'search-results-per-page', 'type' => 'spinner', 'title' => __('Number of Properties Per Page', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('Used For Property Search, Taxonomies etc.', 'tt'), 'default' => 10, 'min' => 2, 'step' => 1, 'max' => 50, 'display_value' => 'label'), array('id' => 'property-new-badge', 'type' => 'spinner', 'title' => __('"New" Property Badge', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('Add <i class="fa fa-fire"></i> icon to property, if published within the last .. days. Set to "0" to disable this feature.', 'tt'), 'default' => 7, 'min' => 0, 'step' => 1, 'max' => 360, 'display_value' => 'label'), array('id' => 'property-comparison-disabled', 'type' => 'checkbox', 'title' => __('Disable Property Comparison', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => 0), array('id' => 'property-favorites-disabled', 'type' => 'checkbox', 'title' => __('Disable Favorites Feature', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => 0), array('id' => 'property-favorites-temporary', 'type' => 'checkbox', 'title' => __('Allow Non-Logged-In Visitors To Save Favorites Temporary', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => 0), array('id' => 'section-property-detail-page', 'type' => 'section', 'title' => __('Property Detail Page', 'tt'), 'subtitle' => __('', 'tt')), array('id' => 'property-meta-data-type', 'type' => 'radio', 'title' => __('Property Meta Data', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'options' => array('default' => __('Default', 'tt'), 'custom' => __('Custom', 'tt')), 'default' => 'default'), array('id' => 'property-custom-meta-data', 'type' => 'repeater', 'title' => __('Custom Meta Data', 'tt'), 'subtitle' => __('FontAwesome icon classes, e.g. "fa-expand", can be found here: <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank">http://fortawesome.github.io/Font-Awesome/icons/</a>. Do not use Advanced Custom Fields with a type of "checkbox" etc., as only single values are accepted.', 'tt'), 'bind_title' => 'property-custom-meta-data-label', 'sortable' => true, 'required' => array('property-meta-data-type', '=', 'custom'), 'fields' => array(array('id' => 'property-custom-meta-data-field', 'title' => __('', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'type' => 'select', 'options' => $merged_fields_listing, 'placeholder' => __('Field Type', 'tt')), array('id' => 'property-custom-meta-data-icon-class', 'type' => 'text', 'placeholder' => __('FontAwesome Icon Class', 'tt')), array('id' => 'property-custom-meta-data-label', 'type' => 'text', 'placeholder' => __('Label', 'tt')), array('id' => 'property-custom-meta-data-label-plural', 'type' => 'text', 'placeholder' => __('Label Plural', 'tt')), array('id' => 'property-custom-meta-data-tooltip', 'type' => 'checkbox', 'subtitle' => __('Show Tooltip Only', 'tt'), 'default' => 0))), array('id' => 'property-meta-data-hide-print', 'type' => 'checkbox', 'title' => __('Property Meta Data: Hide Print Icon', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => 0), array('id' => 'property-id-type', 'type' => 'radio', 'title' => __('Property ID Type', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'options' => array('post_id' => __('Post ID', 'tt'), 'custom_id' => __('Custom Property ID', 'tt')), 'default' => 'post_id'), array('id' => 'property-layout', 'type' => 'radio', 'title' => __('Default Single Property Layout', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'options' => array('layout-full-width' => __('Full Width Property Image / Slideshow', 'tt'), 'layout-boxed' => __('Boxed Property Image / Slideshow', 'tt')), 'default' => 'layout-full-width'), array('id' => 'property-lightbox', 'type' => 'radio', 'title' => __('Property Lightbox', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'options' => array('magnific-popup' => __('Magnific Popup', 'tt'), 'intense-images' => __('Intense Images', 'tt'), 'none' => __('None', 'tt')), 'default' => 'magnific-popup'), array('id' => 'property-image-width', 'type' => 'radio', 'title' => __('Property Image Width', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('Select smaller dimension for faster page load time. Setting doesn\'t effect slideshow container width, image still stretches full width.', 'tt'), 'options' => array('full' => __('Original Image Ratio', 'tt'), 'thumbnail-1600' => __('1600px', 'tt') . ' (new thumbnail size in v1.6.2, if selected make sure to <a href="https://wordpress.org/plugins/regenerate-thumbnails/" target="_blank">regenarate thumbnails</a>)', 'thumbnail-1200' => __('1200px (Default)', 'tt')), 'default' => 'thumbnail-1200'), array('id' => 'property-image-height', 'type' => 'radio', 'title' => __('Property Image Height', 'tt'), 'subtitle' => __('Min. 400px for proper display on mobile', 'tt'), 'desc' => __('', 'tt'), 'options' => array('original' => __('Original Image Ratio', 'tt'), 'fullscreen' => __('Fullscreen (min. 400px for proper display on mobile)', 'tt'), 'custom' => __('Custom Height (min. 400px for proper display on mobile)', 'tt')), 'default' => 'original'), array('id' => 'property-image-custom-height', 'type' => 'text', 'title' => __('Custom Property Image Height', 'tt'), 'subtitle' => __('Default: 400', 'tt'), 'desc' => __('', 'tt'), 'validate' => 'numeric', 'default' => '400', 'required' => array('property-image-height', '=', 'custom')), array('id' => 'property-image-height-fit-or-cut', 'type' => 'radio', 'title' => __('Property Image Overflow Handling', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('Choose to fit or cut off your property images.', 'tt'), 'options' => array('fit' => __('Fit Image', 'tt'), 'cut' => __('Cut Off Image', 'tt')), 'default' => 'cut', 'required' => array('property-image-height', '!=', 'original')), array('id' => 'property-additional-details-hide-empty', 'type' => 'checkbox', 'title' => __('Hide Empty Additional Details', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => 0), array('id' => 'property-features-hide-non-applicable', 'type' => 'checkbox', 'title' => __('Hide Non Applicable Property Features', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => 0), array('id' => 'property-title-details', 'type' => 'text', 'title' => __('Property Title: Details', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => __('', 'tt')), array('id' => 'property-title-additional-details', 'type' => 'text', 'title' => __('Property Title: Custom Fields', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('Won\'t appear, if no advanced custom fields are created.', 'tt'), 'default' => __('Additional details', 'tt')), array('id' => 'property-title-features', 'type' => 'text', 'title' => __('Property Title: Features', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => __('Features', 'tt')), array('id' => 'property-title-map', 'type' => 'text', 'title' => __('Property Title: Map', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => __('Location', 'tt')), array('id' => 'property-title-attachments', 'type' => 'text', 'title' => __('Property Title: Attachments', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => __('Attachments', 'tt')), array('id' => 'property-title-floor-plan', 'type' => 'text', 'title' => __('Property Title: Floor Plan', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => __('Floor Plan', 'tt')), array('id' => 'property-title-agent', 'type' => 'text', 'title' => __('Property Title: Agent', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => __('Agent', 'tt')), array('id' => 'property-floor-plan-disable', 'type' => 'checkbox', 'title' => __('Disable Floor Plans', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => 0), array('id' => 'property-social-sharing', 'type' => 'checkbox', 'title' => __('Display Social Sharing Buttons', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => 1), array('id' => 'property-agent-information', 'type' => 'checkbox', 'title' => __('Display Agent Information', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => 1), array('id' => 'property-contact-form', 'type' => 'checkbox', 'title' => __('Display Contact Form', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => 1), array('id' => 'property-contact-form-cf7-shortcode', 'type' => 'text', 'title' => __('Use Contact Form 7 Instead Of Default Contact Form', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('Enter your Contact Form 7 shortcode ID. Make sure CF7 plugin is activated and that ID entered matches your CF7 form ID. Leave empty to use the default contact form.', 'tt'), 'validate' => 'numeric', 'default' => '', 'required' => array('property-contact-form', '=', '1')), array('id' => 'property-contact-form-default-email', 'type' => 'text', 'title' => __('Default Contact Email Adress', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('Used, if agent has no email address, and on his/her profile page.', 'tt'), 'validate' => 'email', 'default' => ''), array('id' => 'property-similar-properties-criteria', 'type' => 'checkbox', 'title' => 'Similar Properties', 'subtitle' => 'Check criteria that a property has to meet in order to be listed on a property detail page under "Similar Properties".', 'compiler' => 'true', 'options' => array('location' => __('Same location', 'tt'), 'status' => __('Same status', 'tt'), 'type' => __('Same type', 'tt'), 'min_rooms' => __('Min. Rooms', 'tt'), 'max_price' => __('Max. Price', 'tt'), 'available_from' => __('Available From', 'tt')), 'default' => array('location' => '1', 'status' => '0', 'type' => '0', 'min_rooms' => '0', 'max_price' => '0', 'available_from' => '0')), array('id' => 'property-similar-properties-columns', 'type' => 'spinner', 'title' => __('Similar Properties Columns', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => 2, 'min' => 1, 'step' => 1, 'max' => 4, 'display_value' => 'label'), array('id' => 'property-comments', 'type' => 'checkbox', 'title' => __('Show Property Comments', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => 0)));
            /* Property Search
            			============================== */
            $this->sections[] = array('title' => __('Property Search', 'tt'), 'desc' => __('', 'tt'), 'class' => 'property-search-section', 'icon' => 'el-icon-search', 'fields' => array(array('id' => 'section-property-search-fields', 'type' => 'section', 'title' => __('Fields: Property Search', 'tt'), 'subtitle' => '<strong>' . __('Required', 'tt') . ':</strong> ' . __('All search field attributes for every search field. "Unique Search Parameter" has to be all lowercase letters, no spaces. Underscores and dashes allowed.', 'tt') . ' (<a href="//themetrail.com/docs/realty/#property-search" target=_blank">' . __('learn more about the property search', 'tt') . '</a>).'), array('id' => 'property-search-fields', 'type' => 'repeater', 'title' => __('', 'tt'), 'subtitle' => __('', 'tt'), 'bind_title' => 'property-search-label', 'sortable' => true, 'fields' => array(array('id' => 'property-search-field', 'type' => 'select', 'options' => $merged_fields_search, 'placeholder' => __('Search Field Type', 'tt')), array('id' => 'property-search-compare', 'type' => 'select', 'options' => array('equal' => __('Equal', 'tt'), 'greater_than' => __('Greater than', 'tt'), 'less_than' => __('Less than', 'tt'), 'like' => __('Like', 'tt')), 'placeholder' => __('Compare As', 'tt')), array('id' => 'property-search-label', 'type' => 'text', 'placeholder' => __('Search Label', 'tt')), array('id' => 'property-search-parameter', 'type' => 'text', 'placeholder' => __('Unique Search Parameter', 'tt') . ' (' . __('required', 'tt') . ')'))), array('id' => 'section-property-search-mini-fields', 'type' => 'section', 'title' => __('Fields: Property Search Mini', 'tt'), 'subtitle' => __('The following search setup is used in page template &quot;Property Slideshow&quot;. Search fields that are also being used in the property search above, should have identical parameters. Mini search doesn\'t show &quot;More&quot; link.', 'tt')), array('id' => 'property-search-mini-fields', 'type' => 'repeater', 'title' => __('', 'tt'), 'subtitle' => __('', 'tt'), 'bind_title' => 'property-search-mini-label', 'sortable' => true, 'fields' => array(array('id' => 'property-search-mini-field', 'type' => 'select', 'options' => $merged_fields_search, 'placeholder' => __('Search Field Type', 'tt')), array('id' => 'property-search-mini-compare', 'type' => 'select', 'options' => array('equal' => __('Equal', 'tt'), 'greater_than' => __('Greater than', 'tt'), 'less_than' => __('Less than', 'tt'), 'like' => __('Like', 'tt')), 'placeholder' => __('Compare As', 'tt')), array('id' => 'property-search-mini-label', 'type' => 'text', 'placeholder' => __('Search Label', 'tt')), array('id' => 'property-search-mini-parameter', 'type' => 'text', 'placeholder' => __('Unique Search Parameter', 'tt') . ' (' . __('required', 'tt') . ')'))), array('id' => 'section-property-other', 'type' => 'section', 'title' => __('Other', 'tt'), 'subtitle' => __('Even if you are not currently using the price range slider, it is recommended to set default values, instead of leaving them blank.', 'tt')), array('id' => 'property-search-results-disable-map', 'type' => 'checkbox', 'title' => __('Search Results Page: Disable Map', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => 0), array('id' => 'property-search-price-range-min', 'type' => 'text', 'title' => __('Price range: Min. price', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'validate' => 'numeric', 'default' => 0), array('id' => 'property-search-price-range-max', 'type' => 'text', 'title' => __('Price range: Max. price', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'validate' => 'numeric', 'default' => 100000), array('id' => 'property-search-price-range-step', 'type' => 'text', 'title' => __('Price range: Step', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'validate' => 'numeric', 'default' => 10000), array('id' => 'datepicker-language', 'type' => 'select', 'data' => 'pages', 'title' => __('Datepicker Language', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('Select the language of the property search datepicker.', 'tt'), 'options' => array('en' => 'English (Default)', 'ar' => 'Arabic', 'az' => 'Azerbaijani', 'bg' => 'Bulgarian', 'ca' => 'Catalan', 'cs' => 'Czech', 'cy' => 'Welch', 'da' => 'Danish', 'de' => 'German', 'el' => 'Greek', 'es' => 'Spanish', 'et' => 'Estonian', 'fa' => 'Persian', 'fi' => 'Finnish', 'fr' => 'French', 'he' => 'Hebrew', 'hr' => 'Croatian', 'hu' => 'Hungarian', 'id' => 'Bahasa Indonesia', 'is' => 'Icelandic', 'it' => 'Italian', 'ja' => 'Japanese', 'ka' => 'Georgian', 'kk' => 'Kazakh', 'kr' => 'Korean', 'lt' => 'Lithuanian', 'lv' => 'Latvian', 'mk' => 'Macedonian', 'ms' => 'Malay', 'nb' => 'Norwegian (bokmal)', 'nl-BE' => 'Belgium-Dutch', 'nl' => 'Dutch', 'no' => 'Norwegian', 'pl' => 'Polish', 'pt-BR' => 'Brazilian', 'pt' => 'Portuguese', 'ro' => 'Romanian', 'rs-latin' => 'Serbian-latin', 'rs' => 'Serbian-cyrillic', 'ru' => 'Russian', 'sk' => 'Slovak', 'sl' => 'Slovene', 'sq' => 'Albanian', 'sv' => 'Swedish', 'sw' => 'Swahili', 'th' => 'Thai', 'tr' => 'Turkish', 'ua' => 'Ukrainian', 'vi' => 'Vietnamese', 'zh-CN' => 'Simplified Chinese', 'zh-TW' => 'Traditional Chinese'), 'default' => 'en'), array('id' => 'property-search-features', 'type' => 'select', 'data' => 'terms', 'args' => array('taxonomies' => 'property-features'), 'multi' => true, 'sortable' => true, 'title' => __('Property Features', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('Select all property features you want to add to property search form. Order via drag & drop.', 'tt'))));
            /* Property Submit
            			============================== */
            $this->sections[] = array('icon' => 'fa fa-send', 'title' => __('Property Submit', 'tt'), 'desc' => __('', 'tt'), 'fields' => array(array('id' => 'property-submit-default-address-latitude', 'type' => 'text', 'title' => __('Default Address: Latitude', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('e.g.: https://www.google.com/maps/place/London,+UK/@<strong><u>51.5286416</u></strong>,-0.1015987,11z/', 'tt'), 'validate' => 'numeric', 'default' => 51.5286416), array('id' => 'property-submit-default-address-longitude', 'type' => 'text', 'title' => __('Default Address: Longitude', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('e.g.: https://www.google.com/maps/place/London,+UK/@51.5286416,<strong><u>-0.1015987</u></strong>,11z/', 'tt'), 'validate' => 'numeric', 'default' => -0.1015987), array('id' => 'property-submit-notification-email-recipient', 'type' => 'text', 'title' => __('Send Email Notification To', 'tt'), 'subtitle' => __('Get notified about property submit via email.', 'tt'), 'desc' => __('If notification ends up in spam folder, set up <a href="https://wordpress.org/plugins/wp-mail-smtp/" target="_blank">WP Mail SMTP</a> for the email address entered above.', 'tt'), 'validate' => 'email', 'default' => ''), array('id' => 'property-submit-price-suffix', 'type' => 'multi_text', 'title' => __('Submit Form: Price Suffix', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('Add Price Suffix That Users Can Choose From When Submitting A Property. This Helps To Prevent User Typos And Keeps All Submitted Property Data Consistent.', 'tt'), 'add_text' => __('Add Price Suffix', 'tt'), 'default' => array('/day' => __('/day', 'tt'), '/week' => __('/week', 'tt'), '/month' => __('/month', 'tt'))), array('id' => 'property-submit-size-unit', 'type' => 'multi_text', 'title' => __('Submit Form: Size Unit Suffix', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('Add Site Unit That Users Can Choose From When Submitting A Property. This Helps To Prevent User Typos And Keeps All Submitted Property Data Consistent.', 'tt'), 'add_text' => __('Add Site Unit', 'tt'), 'default' => array('sq ft' => __('sq ft', 'tt'), 'm2' => __('m2', 'tt'))), array('id' => 'property-submit-hide-link', 'type' => 'checkbox', 'title' => __('Hide "Submit Property" Link', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => 0), array('id' => 'property-submit-disabled-for-subscriber', 'type' => 'checkbox', 'title' => __('Disable Property Submit For User Role Subscriber', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('If checked, only agents and admins are able to submit properties.', 'tt'), 'default' => 0), array('id' => 'section-property-payment', 'type' => 'section', 'title' => __('Property Payments', 'tt'), 'subtitle' => __('Users with a role of "subscriber" can be charged in order to publish properties. Admins and agents publish properties right away.', 'tt')), array('id' => 'paypal-enable', 'type' => 'checkbox', 'title' => __('Enable property payments via PayPal', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => 0), array('id' => 'paypal-alerts-hide', 'type' => 'checkbox', 'title' => __('Hide PayPal payment notifications on submit page', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => 0), array('id' => 'paypal-enable-subscription', 'type' => 'checkbox', 'title' => __('Enable property subscription via PayPal', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('If checked, recurring payments (subscriptions) will be charged instead of one-time payments.', 'tt'), 'default' => 0), array('id' => 'paypal-subscription-recurrence', 'type' => 'text', 'title' => __('Subscription Recurrences', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('Charge subscription fee every .. (period)', 'tt'), 'validate' => 'numeric', 'default' => 12), array('id' => 'paypal-subscription-period', 'type' => 'select', 'title' => __('Subscription Period', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'options' => array('D' => __('Days', 'tt'), 'W' => __('Weeks', 'tt'), 'M' => __('Months', 'tt'), 'Y' => __('Years', 'tt')), 'default' => 'M'), array('id' => 'paypal-merchant-id', 'type' => 'text', 'title' => __('PayPal merchant ID or email address', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => ''), array('id' => 'paypal-ipn-email-address', 'type' => 'text', 'title' => __('IPN (Instant Payment Notification) email address', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'validate' => 'email', 'default' => ''), array('id' => 'paypal-amount', 'type' => 'text', 'title' => __('Amount to pay per property', 'tt'), 'subtitle' => __('Format: 25.00', 'tt'), 'desc' => __('', 'tt'), 'default' => '25.00'), array('id' => 'paypal-featured-amount', 'type' => 'text', 'title' => __('Charge additional .. to set property "Featured"', 'tt'), 'subtitle' => __('Format: 10.00', 'tt'), 'desc' => __('To disable "Featured" property option, set the amount to "0"', 'tt'), 'default' => '10.00'), array('id' => 'paypal-currency-code', 'type' => 'text', 'title' => __('PayPal currency code', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => 'USD'), array('id' => 'paypal-sandbox', 'type' => 'checkbox', 'title' => __('Enable PayPal sandbox for testing', 'tt'), 'subtitle' => __('Disable to process live transactions.', 'tt'), 'desc' => __('', 'tt'), 'default' => 0), array('id' => 'paypal-ssl', 'type' => 'checkbox', 'title' => __('Post payment over SSL connection', 'tt'), 'subtitle' => __('Recommendation: Enable SSL', 'tt'), 'desc' => __('If disabled, HTTP connection will be used.', 'tt'), 'default' => 1), array('id' => 'paypal-auto-publish', 'type' => 'checkbox', 'title' => __('Auto publish properties on payment completion', 'tt'), 'subtitle' => __('If disabled you have to publish properties manually.', 'tt'), 'desc' => __('', 'tt'), 'default' => 1)));
            /* TYPOGRAPHY
            			============================== */
            $this->sections[] = array('title' => __('Typography', 'tt'), 'desc' => __('', 'tt'), 'icon' => 'fa fa-paragraph', 'fields' => array(array('id' => 'typography-header', 'type' => 'typography', 'title' => __('Typography Header', 'tt'), 'google' => true, 'font-backup' => false, 'font-style' => false, 'font-weight' => false, 'text-align' => false, 'font-size' => true, 'line-height' => false, 'color' => false, 'all_styles' => false, 'output' => array('header.navbar'), 'units' => 'em', 'subtitle' => __('', 'tt'), 'default' => array('font-family' => 'Lato', 'google' => true)), array('id' => 'typography-headings', 'type' => 'typography', 'title' => __('Typography Headings', 'tt'), 'google' => true, 'font-backup' => false, 'font-style' => false, 'font-weight' => true, 'text-align' => false, 'font-size' => true, 'line-height' => false, 'color' => true, 'all_styles' => false, 'output' => array('h1, h2, h3, h4, h5, h6'), 'units' => 'em', 'subtitle' => __('', 'tt'), 'default' => array('font-family' => 'Lato', 'font-style' => '400', 'google' => true, 'color' => '#666')), array('id' => 'typography-body', 'type' => 'typography', 'title' => __('Typography Body', 'tt'), 'google' => true, 'font-backup' => false, 'font-style' => false, 'font-weight' => true, 'text-align' => false, 'font-size' => true, 'line-height' => false, 'color' => true, 'all_styles' => false, 'output' => array('body'), 'units' => 'em', 'subtitle' => __('', 'tt'), 'default' => array('font-family' => 'Open Sans', 'font-style' => '400', 'google' => true, 'color' => '#666'))));
            /* Colors
            			==============================
                     $this->sections[] = array(
                      'title'     => __('Colors', 'tt'),
                      'desc'      => __('', 'tt'),
                      'icon'      => 'fa fa-tint',
                      'fields'    => array(
                        
            					
                       )
                     );
                     */
            /* Format Pricing
            			============================== */
            $this->sections[] = array('title' => __('Format Pricing', 'tt'), 'desc' => __('', 'tt'), 'icon' => 'fa fa-money', 'fields' => array(array('id' => 'price-prefix', 'type' => 'text', 'title' => __('Price Prefix', 'tt'), 'subtitle' => __('e.g. "from "', 'tt'), 'desc' => __('If filled out, prefix appears on every property price. Can be overwritten for each property.', 'tt'), 'default' => ''), array('id' => 'price-suffix', 'type' => 'text', 'title' => __('Price Suffix', 'tt'), 'subtitle' => __('e.g. "/month"', 'tt'), 'desc' => __('If filled out, suffix appears on every property price. Can be overwritten for each property.', 'tt'), 'default' => ''), array('id' => 'currency-sign', 'type' => 'text', 'title' => __('Currency Sign', 'tt'), 'subtitle' => __('Default: $', 'tt'), 'desc' => __('', 'tt'), 'default' => '$'), array('id' => 'currency-sign-position', 'type' => 'radio', 'title' => __('Currency Sign Position', 'tt'), 'subtitle' => __('Default: left', 'tt'), 'desc' => __('', 'tt'), 'options' => array('left' => 'Left', 'right' => 'Right'), 'default' => 'left'), array('id' => 'price-thousands-separator', 'type' => 'text', 'title' => __('Thousands Separator', 'tt'), 'subtitle' => __('Default: ,', 'tt'), 'desc' => __('', 'tt'), 'default' => ','), array('id' => 'price-decimals', 'type' => 'spinner', 'title' => __('Price Decimals', 'tt'), 'subtitle' => __('Default: 0', 'tt'), 'desc' => __('', 'tt'), 'default' => 0, 'min' => 0, 'step' => 1, 'max' => 2, 'display_value' => 'label')));
            /* Footer
            			============================== */
            $this->sections[] = array('title' => __('Footer', 'tt'), 'desc' => __('', 'tt'), 'icon' => 'fa fa-anchor', 'fields' => array(array('id' => 'color-footer-background', 'type' => 'background', 'output' => array('#footer'), 'title' => __('Footer Top Background Color', 'tt'), 'subtitle' => __('', 'tt'), 'default' => array('background-color' => ''), 'background-repeat' => false, 'background-attachment' => false, 'background-position' => false, 'background-image' => false, 'transparent' => false, 'background-size' => false), array('id' => 'color-footer-bottom-background', 'type' => 'background', 'output' => array('#footer #footer-bottom'), 'title' => __('Footer Bottom Background Color', 'tt'), 'subtitle' => __('', 'tt'), 'default' => array('background-color' => ''), 'background-repeat' => false, 'background-attachment' => false, 'background-position' => false, 'background-image' => false, 'transparent' => false, 'background-size' => false), array('id' => 'color-footer', 'type' => 'color', 'title' => __('Footer Color', 'tt'), 'subtitle' => __('Footer Color (default: #999999)', 'tt'), 'default' => '#999999', 'output' => array('#footer #footer-bottom, #footer #footer-bottom a, #footer .widget-title'), 'validate' => 'color', 'transparent' => false), array('id' => 'copyright', 'type' => 'text', 'title' => __('Copyright Text', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => __('&copy; 2014 - <a href="http://themetrail.com">ThemeTrail</a>', 'tt')), array('id' => 'footer-show-up-button', 'type' => 'checkbox', 'title' => __('Display "To The Top" Button', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => 1), array('id' => 'footer-property-search-button', 'type' => 'checkbox', 'title' => __('Display "Property Search" Button', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => 1)));
            /* Social
            			============================== */
            $this->sections[] = array('title' => __('Social', 'tt'), 'desc' => __('', 'tt'), 'icon' => 'fa fa-facebook-square', 'fields' => array(array('id' => 'social-facebook', 'type' => 'text', 'title' => __('Faceook URL', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => '#'), array('id' => 'social-twitter', 'type' => 'text', 'title' => __('Twitter URL', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => '#'), array('id' => 'social-google', 'type' => 'text', 'title' => __('Google+ URL', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => '#'), array('id' => 'social-linkedin', 'type' => 'text', 'title' => __('LinkedIn URL', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => ''), array('id' => 'social-pinterest', 'type' => 'text', 'title' => __('Pinterest URL', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => ''), array('id' => 'social-instagram', 'type' => 'text', 'title' => __('Instagram URL', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => ''), array('id' => 'social-youtube', 'type' => 'text', 'title' => __('YouTube URL', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => ''), array('id' => 'social-skype', 'type' => 'text', 'title' => __('Skype URL', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'default' => '')));
            /* Contact
            			============================== */
            $this->sections[] = array('icon' => 'fa fa-envelope', 'title' => __('Contact', 'tt'), 'desc' => __('Contact Details for Contact Page Template.', 'tt'), 'fields' => array(array('id' => 'contact-google-map', 'type' => 'switch', 'title' => __('Show Google Maps', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('Show Google Map on Contact Page Template.', 'tt'), 'default' => 1, 'on' => __('Yes', 'tt'), 'off' => __('No', 'tt')), array('id' => 'contact-logo', 'type' => 'media', 'title' => __('Logo', 'tt'), 'compiler' => 'true', 'mode' => false, 'desc' => __('', 'tt'), 'subtitle' => __('', 'tt'), 'required' => array('contact-google-map', '=', '1')), array('id' => 'contact-address', 'type' => 'text', 'title' => __('Address', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'msg' => '', 'default' => __('Main St, New York, USA', 'tt'), 'required' => array('contact-google-map', '=', '1')), array('id' => 'contact-phone', 'type' => 'text', 'title' => __('Phone', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'msg' => '', 'default' => '+1 555 22 66 8890', 'required' => array('contact-google-map', '=', '1')), array('id' => 'contact-mobile', 'type' => 'text', 'title' => __('Mobile', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'msg' => '', 'default' => '+1 555 22 66 8891', 'required' => array('contact-google-map', '=', '1')), array('id' => 'contact-email', 'type' => 'text', 'title' => __('Email', 'tt'), 'subtitle' => __('', 'tt'), 'desc' => __('', 'tt'), 'msg' => '', 'default' => '*****@*****.**', 'required' => array('contact-google-map', '=', '1'))));
            if (file_exists(trailingslashit(dirname(__FILE__)) . 'README.html')) {
                $tabs['docs'] = array('icon' => 'el-icon-book', 'title' => __('Documentation', 'tt'), 'content' => nl2br(file_get_contents(trailingslashit(dirname(__FILE__)) . 'README.html')));
            }
        }
Ejemplo n.º 4
0
function tt_property_search_args($search_results_args)
{
    global $realty_theme_option;
    /*if(isset($_POST['pagers'])){
    	  $string_array=explode('/',$_POST['pagers']);
    	  print_r($string_array);	  
    	  $add_pagination_number=$string_array[5];
    	}*/
    //print_r($get_array);
    $search_results_args['post_type'] = 'property';
    $search_results_args['post_status'] = 'publish';
    $search_results_args['paged'] = get_query_var('paged') ? get_query_var('paged') : 1;
    /*if(isset($add_pagination_number)){
    		$search_results_args['paged'] = $add_pagination_number;
    	}*/
    $search_results_per_page = $realty_theme_option['search-results-per-page'];
    // Search Results Per Page: Check for Theme Option
    if ($search_results_per_page) {
        $search_results_args['posts_per_page'] = $search_results_per_page;
    } else {
        $search_results_args['posts_per_page'] = 10;
    }
    // Search Results Order
    if (!empty($_GET['orderby'])) {
        $orderby = $_GET['orderby'];
        // By Date (Newest First)
        if ($orderby == 'date-new') {
            $search_results_args['orderby'] = 'date';
            $search_results_args['order'] = 'DESC';
        }
        // By Date (Oldest First)
        if ($orderby == 'date-old') {
            $search_results_args['orderby'] = 'date';
            $search_results_args['order'] = 'ASC';
        }
        // By Price (Highest First)
        if ($orderby == 'price-high') {
            $search_results_args['meta_key'] = 'estate_property_price';
            $search_results_args['orderby'] = 'meta_value_num';
            $search_results_args['order'] = 'DESC';
        }
        // By Price (Lowest First)
        if ($orderby == 'price-low') {
            $search_results_args['meta_key'] = 'estate_property_price';
            $search_results_args['orderby'] = 'meta_value_num';
            $search_results_args['order'] = 'ASC';
        }
        // Random
        if ($orderby == 'random') {
            $search_results_args['orderby'] = 'rand';
        }
    } else {
        $orderby = '';
    }
    /* META & TAX QUERIES: 
    	============================== */
    $meta_query = array();
    $tax_query = array();
    $i = 0;
    foreach ($_GET as $search_key => $search_value) {
        if ($search_key == "orderby" || $search_key == "pageid") {
            break;
        }
        // Check If Key Has A Value
        if ((!empty($search_value) || $search_key == "price_range_min") && $search_key != "orderby" && $search_key != "pageid") {
            // Search Form Mini
            if (isset($_GET['form']) && $_GET['form'] == "mini") {
                $search_parameters = $realty_theme_option['property-search-mini-parameter'];
                $search_fields = $realty_theme_option['property-search-mini-field'];
                $search_position = array_search($search_key, $search_parameters);
                $search_compare = $realty_theme_option['property-search-mini-compare'][$search_position];
                $search_field = $search_fields[$search_position];
            } else {
                $search_parameters = $realty_theme_option['property-search-parameter'];
                $search_fields = $realty_theme_option['property-search-field'];
                $search_position = array_search($search_key, $search_parameters);
                $search_compare = $realty_theme_option['property-search-compare'][$search_position];
                $search_field = $search_fields[$search_position];
            }
            switch ($search_compare) {
                case 'greater_than':
                case 'greather_than':
                    $search_compare = '>=';
                    break;
                    // Do NOT delete "greather_than" typo
                // Do NOT delete "greather_than" typo
                case 'less_than':
                    $search_compare = '<=';
                    break;
                case 'like':
                    $search_compare = 'LIKE';
                    break;
                default:
                    $search_compare = '=';
                    break;
            }
            // Default Fields
            $default_search_fields_array = array('estate_search_by_keyword', 'estate_property_id', 'estate_property_location', 'estate_property_type', 'estate_property_status', 'estate_property_price', 'estate_property_pricerange', 'estate_property_size', 'estate_property_rooms', 'estate_property_bedrooms', 'estate_property_bathrooms', 'estate_property_garages', 'estate_property_available_from');
            // Default Fields
            if (in_array($search_fields[$i], $default_search_fields_array)) {
                switch ($search_fields[$i]) {
                    // Keyword Search
                    case 'estate_search_by_keyword':
                        $search_results_args['s'] = $search_value;
                        break;
                    case 'estate_property_id':
                        if ($realty_theme_option['property-id-type'] == "post_id") {
                            $search_results_args['p'] = $search_value;
                            // Post ID = Default Property ID
                        } else {
                            $meta_query[] = array('key' => 'estate_property_id', 'value' => $search_value);
                        }
                        break;
                    case 'estate_property_price':
                        $meta_query[] = array('key' => 'estate_property_price', 'value' => $search_value, 'type' => 'NUMERIC', 'compare' => $search_compare);
                        break;
                    case 'estate_property_pricerange':
                        $meta_query[] = array('key' => 'estate_property_price', 'value' => array($_GET['price_range_min'], $_GET['price_range_max']), 'type' => 'NUMERIC', 'compare' => 'BETWEEN');
                        break;
                    case 'estate_property_size':
                        $meta_query[] = array('key' => 'estate_property_size', 'value' => $search_value, 'type' => 'NUMERIC', 'compare' => $search_compare);
                        break;
                    case 'estate_property_rooms':
                        $meta_query[] = array('key' => 'estate_property_rooms', 'value' => $search_value, 'type' => 'NUMERIC', 'compare' => $search_compare);
                        break;
                    case 'estate_property_bedrooms':
                        $meta_query[] = array('key' => 'estate_property_bedrooms', 'value' => $search_value, 'type' => 'NUMERIC', 'compare' => $search_compare);
                        break;
                    case 'estate_property_bathrooms':
                        $meta_query[] = array('key' => 'estate_property_bathrooms', 'value' => $search_value, 'type' => 'NUMERIC', 'compare' => $search_compare);
                        break;
                    case 'estate_property_garages':
                        $meta_query[] = array('key' => 'estate_property_garages', 'value' => $search_value, 'type' => 'NUMERIC', 'compare' => $search_compare);
                        break;
                    case 'estate_property_available_from':
                        $meta_query[] = array('key' => 'estate_property_available_from', 'value' => $search_value, 'type' => 'DATE', 'compare' => $search_compare);
                        break;
                    case 'estate_property_location':
                        if ($search_value != "all") {
                            $tax_query[] = array('taxonomy' => 'property-location', 'field' => 'slug', 'terms' => $search_value);
                        }
                        break;
                    case 'estate_property_type':
                        if ($search_value != "all") {
                            $tax_query[] = array('taxonomy' => 'property-type', 'field' => 'slug', 'terms' => $search_value);
                        }
                        break;
                    case 'estate_property_status':
                        if ($search_value != "all") {
                            $tax_query[] = array('taxonomy' => 'property-status', 'field' => 'slug', 'terms' => $search_value);
                        }
                        break;
                    case 'feature':
                        if ($search_value != "all") {
                            $tax_query[] = array('taxonomy' => 'property-features', 'field' => 'slug', 'terms' => $search_value);
                        }
                        break;
                }
                // switch
            } else {
                if (tt_acf_active() && in_array($search_fields[$i], tt_acf_fields_name(tt_acf_group_id_property()))) {
                    // Get Field Type
                    $acf_field_position = array_search($search_fields[$i], tt_acf_fields_name(tt_acf_group_id_property()));
                    $acf_field_type_key = tt_acf_fields_type(tt_acf_group_id_property());
                    $acf_field_type = $acf_field_type_key[$acf_field_position];
                    $type = '';
                    switch ($acf_field_type) {
                        case 'text':
                            $type = 'CHAR';
                            break;
                        case 'number':
                            $type = 'NUMERIC';
                            break;
                        case 'date_picker':
                            $type = 'DATE';
                            break;
                    }
                    // ACF Type: Checkbox & Radio Buttons
                    if ($acf_field_type == 'checkbox') {
                        $meta_query[] = array('key' => $search_key, 'value' => $search_value, 'compare' => 'LIKE');
                    } else {
                        if ($acf_field_type == 'text' || $acf_field_type == 'number' || $acf_field_type == 'date_picker') {
                            $meta_query[] = array('key' => $search_fields[$i], 'value' => $search_value, 'type' => $type, 'compare' => $search_compare);
                        } else {
                            $meta_query[] = array('key' => $search_key, 'value' => $search_value);
                        }
                    }
                }
            }
            // endif ACF;
        }
        // endif !empty($search_value)
        // Dont increase $i for price range, as we are using two parameters (min & max) already
        if ($search_key != "price_range_min") {
            $i++;
        }
    }
    // end foreach()
    // Count meta & tax querie, then set relation for search query
    $meta_count = count($meta_query);
    if ($meta_count > 1) {
        $meta_query['relation'] = 'AND';
    }
    if ($meta_count > 0) {
        $search_results_args['meta_query'] = $meta_query;
    }
    // Count taxonomy queries + set their relation for search query
    $tax_count = count($tax_query);
    if ($tax_count > 1) {
        $tax_query['relation'] = 'AND';
    }
    if ($tax_count > 0) {
        $search_results_args['tax_query'] = $tax_query;
    }
    return $search_results_args;
}