Exemplo n.º 1
0
 function shandora_page_meta()
 {
     $prefix = bon_get_prefix();
     if (is_admin()) {
         global $bon;
         $mb = $bon->mb();
         $fields = array(array('id' => $prefix . 'slideshow_type', 'type' => 'select', 'label' => __('Slide Show Type', 'bon'), 'options' => array('full' => __('Full', 'bon'), 'boxed' => __('Boxed', 'bon'))), array('id' => $prefix . 'slideshow_ids', 'type' => 'text', 'label' => __('Slide show IDs to Show (optional)', 'bon'), 'desc' => __('Input the slideshow ids you want to show separated by commas, if empty all latest slider post will be used.', 'bon')));
         $mb->create_box('slider-opt', __('Slider Options', 'bon'), $fields, array('page'));
     }
 }
 function bon_toolkit_get_prefix()
 {
     global $bon, $bontoolkit;
     if (function_exists('bon_get_prefix')) {
         $prefix = bon_get_prefix();
     } else {
         $prefix = $bontoolkit->prefix;
     }
     return $prefix;
 }
Exemplo n.º 3
0
 function shandora_setup_agent_post_type()
 {
     global $bon;
     $prefix = bon_get_prefix();
     $cpt = $bon->cpt();
     $name = __('Agent', 'bon');
     $plural = __('Agents', 'bon');
     $cpt->create('Agent', array('supports' => array('editor', 'title'), 'exclude_from_search' => true, 'menu_position' => 7), array(), $name, $plural);
     $agent_opt1 = array(array('label' => __('Job Title', 'bon'), 'desc' => '', 'id' => $prefix . 'agentjob', 'type' => 'text'), array('label' => __('Facebook Username', 'bon'), 'desc' => '', 'id' => $prefix . 'agentfb', 'type' => 'text'), array('label' => __('Twitter Username', 'bon'), 'desc' => '', 'id' => $prefix . 'agenttw', 'type' => 'text'), array('label' => __('LinkedIn Username', 'bon'), 'desc' => '', 'id' => $prefix . 'agentlinkedin', 'type' => 'text'), array('label' => __('Agent Profile Photo', 'bon'), 'desc' => '', 'id' => $prefix . 'agentpic', 'type' => 'image'), array('label' => __('Email Address', 'bon'), 'desc' => '', 'id' => $prefix . 'agentemail', 'type' => 'text'), array('label' => __('Office Phone Number', 'bon'), 'desc' => '', 'id' => $prefix . 'agentofficephone', 'type' => 'text'), array('label' => __('Mobile Phone Number', 'bon'), 'desc' => '', 'id' => $prefix . 'agentmobilephone', 'type' => 'text'), array('label' => __('Fax Number', 'bon'), 'desc' => '', 'id' => $prefix . 'agentfax', 'type' => 'text'));
     $cpt->add_meta_box('agent-options', 'Agent Options', $agent_opt1);
 }
Exemplo n.º 4
0
function shandora_boat_meta_box_options()
{
    $prefix = bon_get_prefix();
    $suffix = SHANDORA_MB_SUFFIX;
    $measure_w = bon_get_option('width_measure');
    $measure_h = bon_get_option('height_measure');
    $measure_l = bon_get_option('length_measure');
    $detail_options = array(array('label' => __('Reg Number', 'bon'), 'desc' => __('The Boat Registry Number #', 'bon'), 'id' => $prefix . $suffix . 'reg', 'type' => 'text'), array('label' => __('Boat Condition', 'bon'), 'desc' => __('Boat sale condition', 'bon'), 'id' => $prefix . $suffix . 'status', 'type' => 'select', 'options' => shandora_get_boat_search_option('status')), array('label' => __('Exterior Color', 'bon'), 'desc' => __('Exterior Color', 'bon'), 'id' => $prefix . $suffix . 'extcolor', 'type' => 'text'), array('label' => __('Interior Color', 'bon'), 'desc' => __('Interior Color', 'bon'), 'id' => $prefix . $suffix . 'intcolor', 'type' => 'text'), array('label' => __('Hours', 'bon'), 'desc' => __('The boat used hours.', 'bon'), 'id' => $prefix . $suffix . 'hours', 'type' => 'text'), array('label' => __('Fuel Type', 'bon'), 'desc' => __('Fuel Type', 'bon'), 'id' => $prefix . $suffix . 'fueltype', 'type' => 'select', 'options' => shandora_get_boat_search_option('fuel')), array('label' => __('Max Speed', 'bon'), 'desc' => __('Max Speed in knots.', 'bon'), 'id' => $prefix . $suffix . 'speed', 'type' => 'text', 'measure' => bon_get_option('speed_measure')), array('label' => __('People Capacity', 'bon'), 'desc' => __('How many people can be hold on the boat capacity.', 'bon'), 'id' => $prefix . $suffix . 'people_cap', 'type' => 'text', 'measure' => __('People', 'bon')), array('label' => __('Year', 'bon'), 'desc' => __('When is the car year build? eq: 2013', 'bon'), 'id' => $prefix . $suffix . 'yearbuild', 'type' => 'text'), array('label' => __('Canvas', 'bon'), 'desc' => __('Canvas', 'bon'), 'id' => $prefix . $suffix . 'canvas', 'type' => 'select', 'options' => shandora_get_boat_search_option('canvas')), array('label' => __('Carpet', 'bon'), 'desc' => __('Carpet', 'bon'), 'id' => $prefix . $suffix . 'carpet', 'type' => 'text'), array('label' => __('Steering Type', 'bon'), 'desc' => __('The boat steering type', 'bon'), 'id' => $prefix . $suffix . 'steering', 'type' => 'text'));
    $dimension_options = array(array('label' => __('Overall Height', 'bon'), 'desc' => __('The overall boat height', 'bon'), 'id' => $prefix . $suffix . 'height', 'type' => 'text', 'measure' => $measure_h), array('label' => __('Overall Width', 'bon'), 'desc' => __('The overall boat width', 'bon'), 'id' => $prefix . $suffix . 'width', 'type' => 'text', 'measure' => $measure_w), array('label' => __('Overall Length', 'bon'), 'desc' => __('The overall boat length', 'bon'), 'id' => $prefix . $suffix . 'length', 'type' => 'text', 'measure' => $measure_l), array('label' => __('Waterline Length', 'bon'), 'desc' => __('The boat waterline length', 'bon'), 'id' => $prefix . $suffix . 'waterline_length', 'type' => 'text', 'measure' => $measure_l), array('label' => __('Max Beam', 'bon'), 'desc' => __('The boat beam width', 'bon'), 'id' => $prefix . $suffix . 'beam', 'type' => 'text', 'measure' => $measure_w), array('label' => __('Max Draft', 'bon'), 'desc' => __('The boat draft height', 'bon'), 'id' => $prefix . $suffix . 'draft', 'type' => 'text', 'measure' => $measure_h));
    $capacity_options = array(array('label' => __('Fuel Tanks', 'bon'), 'desc' => __('Fuel Tanks', 'bon'), 'id' => $prefix . $suffix . 'fuelcaps', 'type' => 'text'), array('label' => __('Fresh Water', 'bon'), 'desc' => __('Fresh Water', 'bon'), 'id' => $prefix . $suffix . 'freshwater', 'type' => 'text'), array('label' => __('Black Water', 'bon'), 'desc' => __('Black Water', 'bon'), 'id' => $prefix . $suffix . 'blackwater', 'type' => 'text'), array('label' => __('Bilge Water', 'bon'), 'desc' => __('Bilge Water', 'bon'), 'id' => $prefix . $suffix . 'bilgewater', 'type' => 'text'), array('label' => __('Grey Water', 'bon'), 'desc' => __('Grey Water', 'bon'), 'id' => $prefix . $suffix . 'greywater', 'type' => 'text'), array('label' => __('Fuel Overflow', 'bon'), 'desc' => __('Fuel Overflow', 'bon'), 'id' => $prefix . $suffix . 'fueloverflow', 'type' => 'text'), array('label' => __('Lube Oil', 'bon'), 'desc' => __('Lube Oil', 'bon'), 'id' => $prefix . $suffix . 'lubeoil', 'type' => 'text'), array('label' => __('Dirty Oil', 'bon'), 'desc' => __('Dirty Oil', 'bon'), 'id' => $prefix . $suffix . 'dirtyoil', 'type' => 'text'), array('label' => __('Sludge', 'bon'), 'desc' => __('Sludge', 'bon'), 'id' => $prefix . $suffix . 'sludge', 'type' => 'text'), array('label' => __('Watermist', 'bon'), 'desc' => __('Watermist', 'bon'), 'id' => $prefix . $suffix . 'watermist', 'type' => 'text'));
    $misc_options = array(array('label' => __('Badge', 'bon'), 'desc' => __('badge text to show in listings view', 'bon'), 'id' => $prefix . $suffix . 'badge', 'type' => 'text'), array('label' => __('Badge color', 'bon'), 'desc' => __('badge text to show in listings view', 'bon'), 'id' => $prefix . $suffix . 'badge_color', 'type' => 'select', 'options' => array('none' => __('None', 'bon'), 'badge-red' => __('Red', 'bon'), 'badge-orange' => __('Orange', 'bon'), 'badge-green' => __('Green', 'bon'), 'badge-blue' => __('Blue', 'bon'), 'badge-purple' => __('Purple', 'bon'), 'badge-gray' => __('Gray', 'bon'))), array('label' => __('Price', 'bon'), 'desc' => __('The Property Price. Fill with numeric only, eq: 123456', 'bon'), 'id' => $prefix . $suffix . 'price', 'type' => 'text'), array('label' => __('Price as Text', 'bon'), 'desc' => __('Set price to use text. Text Options can be filled in theme Options, Shandora > Listing Settings > Price as Text.', 'bon'), 'id' => $prefix . $suffix . 'pricetext', 'type' => 'checkbox'), array('label' => __('Featured Boat', 'bon'), 'desc' => __('Make the listing featured for featured listing widget', 'bon'), 'id' => $prefix . $suffix . 'featured', 'type' => 'checkbox'), array('label' => __('Agent for this listing', 'bon'), 'desc' => __('The sales rep pointed for this boat listing', 'bon'), 'id' => $prefix . $suffix . 'agentpointed', 'type' => 'old_post_select', 'post_type' => 'agent'));
    $opts = array('gallery-options' => array('label' => __('Gallery', 'bon'), 'options' => shandora_gallery_metabox_args(), 'show_ui' => false), 'boat-misc-options' => array('label' => __('Miscellaneous', 'bon'), 'options' => $misc_options, 'show_ui' => false), 'boat-detail-options' => array('label' => __('Detail', 'bon'), 'options' => $detail_options, 'show_ui' => true), 'boat-dimension-options' => array('label' => __('Dimension', 'bon'), 'options' => $dimension_options, 'show_ui' => true), 'boat-capacity-options' => array('label' => __('Capacity', 'bon'), 'options' => $capacity_options, 'show_ui' => true, 'measure' => bon_get_option('volume_measure', 'litres')), 'video-options' => array('label' => __('Video', 'bon'), 'options' => shandora_video_metabox_args(), 'show_ui' => false));
    return $opts;
}
    $orderby = $_GET['search_orderby'];
}
if (isset($_GET['search_order'])) {
    $order = $_GET['search_order'];
}
switch ($orderby) {
    case 'price':
        $orderby = 'meta_value_num';
        $key = bon_get_prefix() . 'listing_price';
        break;
    case 'title':
        $orderby = 'title';
        break;
    case 'size':
        $orderby = 'meta_value_num';
        $key = bon_get_prefix() . 'listing_buildingsize';
        break;
    default:
        $orderby = 'date';
        break;
}
$search_args['meta_key'] = $key;
$search_args['orderby'] = $orderby;
$search_args['order'] = $order;
// wp query
$wp_query = new WP_Query($search_args);
?>

                <?php 
bon_get_template_part('loop', 'listing');
?>
Exemplo n.º 6
0
<?php

$args = array('posts_per_page' => 48, 'post_type' => 'listing', 'post_status' => 'publish', 'paged' => $paged, 'meta_query' => array(array('key' => bon_get_prefix() . 'listing_agentpointed', 'value' => serialize(array(strval($post->ID))), 'compare' => '=')));
$agent_query = new WP_Query($args);
if ($agent_query->have_posts()) {
    $compare_page = bon_get_option('compare_page');
    ?>

<ul class="listings <?php 
    shandora_block_grid_column_class();
    ?>
" data-compareurl="<?php 
    echo get_permalink($compare_page);
    ?>
">
			
<?php 
    while ($agent_query->have_posts()) {
        $agent_query->the_post();
        $status = shandora_get_meta($post->ID, 'listing_status');
        $bed = shandora_get_meta($post->ID, 'listing_bed');
        $bath = shandora_get_meta($post->ID, 'listing_bath');
        $lotsize = shandora_get_meta($post->ID, 'listing_lotsize');
        $sizemeasurement = bon_get_option('measurement');
        $view = isset($_GET['view']) ? $_GET['view'] : 'grid';
        $li_class = '';
        if ($agent_query->current_post + 1 == $agent_query->post_count) {
            $li_class = 'last';
        }
        ?>
<li class="<?php 
Exemplo n.º 7
0
function shandora_exclude_sold_rented($where, &$wp_query)
{
    global $wpdb;
    $where .= ' AND ' . $wpdb->posts . '.ID NOT IN (SELECT DISTINCT post_id FROM ' . $wpdb->postmeta . ' WHERE meta_key = \'' . esc_sql(esc_attr(bon_get_prefix() . 'listing_status')) . '\' AND ( meta_value = \'' . esc_sql(esc_attr('sold')) . '\'  OR meta_value = \'' . esc_sql(esc_attr('rented')) . '\' ) )';
    return $where;
}
    $orderby = $_GET['search_orderby'];
}
if (isset($_GET['search_order'])) {
    $order = $_GET['search_order'];
}
switch ($orderby) {
    case 'price':
        $orderby = 'meta_value_num';
        $key = bon_get_prefix() . 'listing_price';
        break;
    case 'title':
        $orderby = 'title';
        break;
    case 'size':
        $orderby = 'meta_value_num';
        $key = bon_get_prefix() . 'listing_length';
        break;
    default:
        $orderby = 'date';
        break;
}
$search_args['meta_key'] = $key;
$search_args['orderby'] = $orderby;
$search_args['order'] = $order;
// wp query
$wp_query = new WP_Query($search_args);
?>

                <?php 
bon_get_template_part('loop', 'boat-listing');
?>
    case 'title':
        $orderby = 'title';
        break;
    case 'size':
        $orderby = 'meta_value_num';
        $key = bon_get_prefix() . 'listing_buildingsize';
        break;
    default:
        $orderby = 'date';
        break;
}
$status_key = '';
$status_val = '';
$exclude_sold_rented = bon_get_option('exclude_sold_rented', 'no');
if ($exclude_sold_rented == 'yes') {
    $status_key = bon_get_prefix() . 'listing_status';
    $status_val = array('sold', 'rented');
}
$listing_args = array('post_type' => 'listing', 'posts_per_page' => $numberposts, 'paged' => $paged, 'meta_key' => $key, 'orderby' => $orderby, 'order' => $order, 'meta_key__not_in' => $status_key, 'meta_value__not_in' => $status_val);
$wp_query = new WP_Query($listing_args);
bon_get_template_part('loop', 'listing');
bon_get_template_part('loop', 'nav');
// Loads the loop-nav.php template.
?>
                
            <?php 
/**
 * Shandora After Loop Hook
 *
 * @hooked shandora_close_main_content_column - 1
 * @hooked shandora_get_right_sidebar - 5
Exemplo n.º 10
0
/**
 * Function for formatting a hook name if needed. It automatically adds the theme's prefix to 
 * the hook, and it will add a context (or any variable) if it's given.
 *
 * @since 1.0
 * @access public
 * @param string $tag The basic name of the hook (e.g., 'before_header').
 * @param string $context A specific context/value to be added to the hook.
 */
function bon_format_hook($tag, $context = '')
{
    return bon_get_prefix() . (!empty($context) ? "{$context}" : "") . "_{$tag}";
}
Exemplo n.º 11
0
    /**
     * Outputs the widget based on the arguments input through the widget controls.
     *
     * @since 1.0
     */
    function widget($sidebar, $instance)
    {
        extract($sidebar);
        /* Set the $args for wp_get_archives() to the $instance array. */
        $args = $instance;
        /* Overwrite the $echo argument and set it to false. */
        $args['echo'] = false;
        /* Output the theme's $before_widget wrapper. */
        echo $before_widget;
        /* If a title was input by the user, display it. */
        if (!empty($instance['title'])) {
            echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
        }
        ?>
		
		<div class="row">
			<div class="column large-12 featured-listing-carousel">
				<?php 
        $prefix = bon_get_prefix();
        $query = array('post_type' => 'car-listing', 'posts_per_page' => $args['limit'], 'meta_query' => array(array('key' => $prefix . 'listing_featured', 'value' => true, 'compare' => '=')));
        $featured_query = new WP_Query($query);
        if ($featured_query->have_posts()) {
            $i = 0;
            ?>

					<script>
						jQuery(document).ready(function($){
							$('#<?php 
            echo $this->id;
            ?>
-slider').flexslider({
								animation: "slide",
								controlNav: false,
								controlsContainer: "#<?php 
            echo $this->id;
            ?>
-nav"
							});
						});
					</script>
					<div id="<?php 
            echo $this->id;
            ?>
-nav" class="featured-listing-nav">
					</div>
					<div id="<?php 
            echo $this->id;
            ?>
-slider">

	        			<ul class="slides">

					<?php 
            while ($featured_query->have_posts()) {
                $featured_query->the_post();
                ?>
						<?php 
                if ($i == 0) {
                    ?>
							<li>
						<?php 
                }
                ?>
						
						<div class="featured-item featured-car-item">
							<?php 
                if (current_theme_supports('get-the-image')) {
                    get_the_image(array('size' => 'listing_medium', 'before' => '<div class="featured-image">', 'after' => '</div>'));
                }
                ?>
							<div class="featured-item-title">
								<h2 class="title"><i class="bonicons bi-link"></i><a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title_attribute();
                ?>
" ><?php 
                the_title();
                ?>
</a></h2>
							</div>
						</div>
						
	                    <?php 
                $i++;
                if ($i == $args['per_slide']) {
                    $i = 0;
                    ?>
	                    	</li>
	                	<?php 
                }
                ?>
					<?php 
            }
            ?>
						<?php 
            if ($i > 0) {
                ?>
							</li>
						<?php 
            }
            ?>
						</ul>
						
					</div>

					<?php 
        } else {
            echo '<p>' . __('No property listing were found', 'bon') . '</p>';
        }
        wp_reset_query();
        ?>
			</div>
		</div>

	<?php 
        /* Close the theme's widget wrapper. */
        echo $after_widget;
    }
Exemplo n.º 12
0
function shandora_listing_post_per_page($query)
{
    if (!is_admin()) {
        if (($query->is_tax(get_object_taxonomies('listing')) || $query->is_tax(get_object_taxonomies('car-listing')) || $query->is_tax(get_object_taxonomies('boat-listing'))) && $query->is_main_query()) {
            $numberposts = bon_get_option('listing_per_page') ? bon_get_option('listing_per_page') : 8;
            $orderby = bon_get_option('listing_orderby');
            $order = bon_get_option('listing_order', 'DESC');
            $key = '';
            if (isset($_GET['search_orderby'])) {
                $orderby = $_GET['search_orderby'];
            }
            if (isset($_GET['search_order'])) {
                $order = $_GET['search_order'];
            }
            switch ($orderby) {
                case 'price':
                    $orderby = 'meta_value_num';
                    $key = bon_get_prefix() . 'listing_price';
                    break;
                case 'title':
                    $orderby = 'title';
                    break;
                case 'size':
                    $orderby = 'meta_value_num';
                    if ($query->is_tax(get_object_taxonomies('listing'))) {
                        $key = bon_get_prefix() . 'listing_buildingsize';
                    } else {
                        if ($query->is_tax(get_object_taxonomies('car-listing'))) {
                            $key = bon_get_prefix() . 'listing_mileage';
                        }
                    }
                    break;
                default:
                    $orderby = 'date';
                    break;
            }
            /*
            			if( $query->is_tax( get_object_taxonomies( 'listing' ) ) ) {
            				$query->set('post_type', 'listing');
            			} else if ( $query->is_tax( get_object_taxonomies( 'car-listing' ) ) ) {
            				$query->set('post_type', 'car-listing');
            			} else if( $query->is_tax( get_object_taxonomies( 'boat-listing') ) ) {
            				$query->set('post_type', 'boat-listing');
            			}*/
            $prop_tax = get_object_taxonomies('listing');
            $car_tax = get_object_taxonomies('car-listing');
            $boat_tax = get_object_taxonomies('boat-listing');
            if ($query->is_tax() && in_array($query->tax_query->queries[0]['taxonomy'], $prop_tax)) {
                $query->set('post_type', 'listing');
            } else {
                if ($query->is_tax() && in_array($query->tax_query->queries[0]['taxonomy'], $car_tax)) {
                    $query->set('post_type', 'car-listing');
                } else {
                    if ($query->is_tax() && in_array($query->tax_query->queries[0]['taxonomy'], $boat_tax)) {
                        $query->set('post_type', 'boat-listing');
                    }
                }
            }
            $paged = get_query_var('paged') ? get_query_var('paged') : 1;
            $query->set('meta_key', $key);
            $query->set('orderby', $orderby);
            $query->set('order', $order);
            $query->set('paged', $paged);
            $query->set('posts_per_page', $numberposts);
        }
    }
}
if (isset($_GET['search_orderby'])) {
    $orderby = $_GET['search_orderby'];
}
$order = 'DESC';
if (isset($_GET['search_order'])) {
    $order = $_GET['search_order'];
}
if ($orderby == 'price') {
    $key = bon_get_prefix() . 'listing_price';
    $orderby = 'meta_value_num';
}
$meta_query = array();
if ($status_val != 'featured') {
    $meta_query[] = array('key' => bon_get_prefix() . 'listing_status', 'value' => $status_val, 'compare' => '=');
} else {
    $meta_query[] = array('key' => bon_get_prefix() . 'listing_featured', 'value' => true, 'compare' => '=');
}
$tax_query = array();
$location_val = get_post_meta(get_the_ID(), 'shandora_dealer_location_query', true);
$type_val = get_post_meta(get_the_ID(), 'shandora_body_type_query', true);
$manufacturer_val = get_post_meta(get_the_ID(), 'shandora_manufacturer_query', true);
if ($type_val != '' && $type_val != 'any') {
    $tax_query[] = array('taxonomy' => 'body-type', 'field' => 'slug', 'terms' => $type_val);
}
if ($location_val != '' && $location_val != 'any') {
    $tax_query[] = array('taxonomy' => 'dealer-location', 'field' => 'slug', 'terms' => $location_val);
}
if ($manufacturer_val != '' && $manufacturer_val != 'any') {
    $tax_query[] = array('taxonomy' => 'manufacturer', 'field' => 'slug', 'terms' => $manufacturer_val);
}
if (count($tax_query) > 1) {
Exemplo n.º 14
0
    /**
     * Outputs the widget based on the arguments input through the widget controls.
     *
     * @since 1.0
     */
    function widget($sidebar, $instance)
    {
        extract($sidebar);
        /* Set the $args for wp_get_archives() to the $instance array. */
        $args = $instance;
        /* Overwrite the $echo argument and set it to false. */
        $args['echo'] = false;
        if (!is_singular('listing')) {
            return;
        }
        /* Output the theme's $before_widget wrapper. */
        echo $before_widget;
        /* If a title was input by the user, display it. */
        if (!empty($instance['title'])) {
            echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
        }
        ?>
		
		<div class="row">
			<div class="column large-12 featured-listing-carousel">
				<?php 
        global $post;
        $tax_query = array();
        $meta_query = array();
        foreach ($instance['related_to'] as $related_key) {
            $prefix = bon_get_prefix();
            switch ($related_key) {
                case 'bed':
                    $beds = shandora_get_meta($post->ID, 'listing_bed');
                    if (!empty($beds)) {
                        $meta_query[] = array('key' => $prefix . 'listing_bed', 'value' => $beds, 'compare' => '<=', 'type' => 'NUMERIC');
                    }
                    break;
                case 'bath':
                    $baths = shandora_get_meta($post->ID, 'listing_bath');
                    if (!empty($baths)) {
                        $meta_query[] = array('key' => $prefix . 'listing_bath', 'value' => $baths, 'compare' => '<=', 'type' => 'NUMERIC');
                    }
                    break;
                case 'lotsize':
                    $lotsize = shandora_get_meta($post->ID, 'listing_lotsize');
                    if (!empty($lotsize)) {
                        $meta_query[] = array('key' => $prefix . 'listing_lotsize', 'value' => $lotsize, 'compare' => '<=', 'type' => 'NUMERIC');
                    }
                    break;
                case 'status':
                    $status = shandora_get_meta($post->ID, 'listing_status');
                    if (!empty($status)) {
                        $meta_query[] = array('key' => $prefix . 'listing_status', 'value' => $status, 'compare' => '=');
                    }
                    break;
                case 'price':
                    $price = shandora_get_meta($post->ID, 'listing_price');
                    if (!empty($price)) {
                        $min_price = 0;
                        if ($price > 0) {
                            $min_price = round($price / 2);
                        }
                        $status = shandora_get_meta($post->ID, 'listing_price');
                        $meta_query[] = array('key' => $prefix . 'listing_price', 'value' => array($min_price, $price), 'compare' => 'BETWEEN', 'type' => 'NUMERIC');
                    }
                    break;
                case 'type':
                    $property_types = wp_get_object_terms($post->ID, 'property-type', array('fields' => 'slugs'));
                    $tax_query[] = array('taxonomy' => 'property-type', 'field' => 'slug', 'terms' => $property_types);
                    break;
                case 'location':
                    $property_locations = wp_get_object_terms($post->ID, 'property-location', array('fields' => 'slugs'));
                    $tax_query[] = array('taxonomy' => 'property-location', 'field' => 'slug', 'terms' => $property_locations);
                    break;
                case 'feature':
                    $property_features = wp_get_object_terms($post->ID, 'property-feature', array('fields' => 'slugs'));
                    $tax_query[] = array('taxonomy' => 'property-feature', 'field' => 'slug', 'terms' => $property_features);
                    break;
            }
        }
        $meta_count = count($meta_query);
        if ($meta_count > 1) {
            $meta_query['relation'] = 'AND';
        }
        $tax_count = count($tax_query);
        if ($tax_count > 1) {
            $tax_query['relation'] = 'OR';
        }
        $query = array('post_type' => 'listing', 'posts_per_page' => $args['limit'], 'meta_query' => $meta_query, 'post__not_in' => array($post->ID), 'tax_query' => $tax_query);
        $related_query = new WP_Query($query);
        if ($related_query->have_posts()) {
            $i = 0;
            ?>

					<script>
						jQuery(document).ready(function($){
							$('#<?php 
            echo $this->id;
            ?>
-slider').flexslider({
								animation: "slide",
								controlNav: false,
								controlsContainer: "#<?php 
            echo $this->id;
            ?>
-nav"
							});
						});
					</script>
					<div id="<?php 
            echo $this->id;
            ?>
-nav" class="featured-listing-nav">
					</div>
					<div id="<?php 
            echo $this->id;
            ?>
-slider">

	        			<ul class="slides">

					<?php 
            while ($related_query->have_posts()) {
                $related_query->the_post();
                ?>
						<?php 
                if ($i == 0) {
                    ?>
							<li>
						<?php 
                }
                ?>
						
						<div class="featured-item">
							<?php 
                if (current_theme_supports('get-the-image')) {
                    get_the_image(array('size' => 'listing_medium', 'before' => '<div class="featured-image">', 'after' => '</div>'));
                }
                ?>
							<?php 
                $bed = shandora_get_meta(get_the_ID(), 'listing_bed');
                $bath = shandora_get_meta(get_the_ID(), 'listing_bath');
                ?>
							<span class="featured-item-meta hide-for-medium bed"><i class="sha-bed"></i><?php 
                echo $bed;
                ?>
</span>
							<span class="featured-item-meta hide-for-medium bath"><i class="sha-bath"></i><?php 
                echo $bath;
                ?>
</span>
							<div class="featured-item-title">
								<h2 class="title"><i class="bonicons bi-link"></i><a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title_attribute();
                ?>
" ><?php 
                the_title();
                ?>
</a></h2>
							</div>
						</div>
						
	                    <?php 
                $i++;
                if ($i == 3) {
                    $i = 0;
                    ?>
	                    	</li>
	                	<?php 
                }
                ?>
					<?php 
            }
            ?>
						<?php 
            if ($i > 0) {
                ?>
							</li>
						<?php 
            }
            ?>
						</ul>
						
					</div>

					<?php 
        } else {
            echo '<p>' . __('No Related listing were found', 'bon') . '</p>';
        }
        wp_reset_query();
        ?>
			</div>
		</div>

	<?php 
        /* Close the theme's widget wrapper. */
        echo $after_widget;
    }
 $location = array();
 if ($terms && !is_wp_error($terms)) {
     foreach ($terms as $term) {
         $location[] = $term->name;
     }
 }
 $location = implode(', ', $location);
 $terms = get_the_terms($post->ID, 'manufacturer');
 $manufacturer = array();
 if ($terms && !is_wp_error($terms)) {
     foreach ($terms as $term) {
         $manufacturer[] = $term->name;
     }
 }
 $manufacturer = implode(', ', $manufacturer);
 $agent_ids = get_post_meta($post->ID, bon_get_prefix() . 'listing_agentpointed', true);
 $link = '<a class="button red flat radius" href="' . get_permalink($post->ID) . '" title="' . get_the_title($post->ID) . '">' . __('View Listing', 'bon') . '</a>';
 $agent = '';
 if (is_array($agent_ids)) {
     $len = count($agent_ids);
     $i = 1;
     foreach ($agent_ids as $agent_id) {
         if ($len > 1 && $i < $len) {
             $agent .= get_the_title($agent_id) . ', ';
         } else {
             $agent .= get_the_title($agent_id);
         }
         $i++;
     }
 }
 $featured = '';
Exemplo n.º 16
0
function shandora_render_builder_element_car_listing($value)
{
    $layout = get_theme_mod('theme_layout');
    if (empty($layout)) {
        $layout = get_post_layout(get_queried_object_id());
    }
    extract($value);
    $o = '';
    $car_ids = array();
    if ($body_type == 'all' || !empty($car_id)) {
        $body_type = '';
    }
    if ($dealer_location == 'all' || !empty($car_id)) {
        $dealer_location = '';
    }
    if ($car_feature == 'all' || !empty($car_id)) {
        $car_feature = '';
    }
    if ($manufacturer == 'all' || !empty($car_id)) {
        $manufacturer = '';
    }
    $meta_car_query = array();
    if (!empty($car_id)) {
        $car_ids = explode(',', $car_id);
    } else {
        if (isset($car_query) && $car_query != ' latest') {
            switch ($car_query) {
                case 'featured':
                    $meta_car_query = array('key' => bon_get_prefix() . 'listing_featured', 'value' => true, 'compare' => '=');
                    break;
                case 'new':
                    $meta_car_query = array('key' => bon_get_prefix() . 'listing_status', 'value' => 'new', 'compare' => '=');
                    break;
                case 'used':
                    $meta_car_query = array('key' => bon_get_prefix() . 'listing_status', 'value' => 'used', 'compare' => '=');
                    break;
                case 'certified':
                    $meta_car_query = array('key' => bon_get_prefix() . 'listing_status', 'value' => 'certified', 'compare' => '=');
                    break;
            }
        }
    }
    $car_loop = array('post_type' => 'car-listing', 'post__in' => $car_ids, 'posts_per_page' => $numberposts, 'body-type' => $body_type, 'dealer-location' => $dealer_location, 'car-feature' => $car_feature, 'manufacturer' => $manufacturer, 'meta_query' => array($meta_car_query));
    $mobile = bon_get_option('mobile_layout', '2');
    $block_cls = '4';
    if ($layout == '2c-l' || $layout == '2c-r') {
        $block_cls = '3';
    }
    $ul_class = "small-block-grid-" . $mobile . " large-block-grid-" . $block_cls;
    $compare_page = bon_get_option('compare_page');
    query_posts($car_loop);
    if (have_posts()) {
        $o .= '<div id="listings-container" class="row">';
        $o .= '<div class="' . shandora_column_class('large-12', false) . '">';
        $o .= '<ul class="listings ' . $ul_class . '" data-compareurl="' . get_permalink($compare_page) . '">';
        while (have_posts()) {
            the_post();
            $suffix = 'listing_';
            $badge = shandora_get_meta(get_the_ID(), $suffix . 'badge');
            $badgeclr = shandora_get_meta(get_the_ID(), $suffix . 'badge_color');
            $o .= '<li>';
            $o .= '<article id="post-' . get_the_ID() . '" class="' . join(' ', get_post_class($badgeclr, null, false)) . '" itemscope itemtype="http://schema.org/RealEstateAgent">';
            ob_start();
            bon_get_template_part('block', 'listing-header');
            $o .= ob_get_clean();
            $o .= '<div class="entry-summary">';
            ob_start();
            do_atomic('entry_summary');
            $o .= ob_get_clean();
            $o .= '</div>';
            ob_start();
            bon_get_template_part('block', 'listing-footer');
            $o .= ob_get_clean();
            $o .= '</article></li>';
        }
        $o .= '</ul></div></div>';
    }
    wp_reset_query();
    return $o;
}
$order = 'DESC';
if (isset($_GET['search_order'])) {
    $order = $_GET['search_order'];
}
if ($orderby == 'price') {
    $key = bon_get_prefix() . 'listing_price';
    $orderby = 'meta_value_num';
}
$meta_query = array();
if ($status_val != 'featured') {
    $meta_query[] = array('key' => bon_get_prefix() . 'listing_status', 'value' => $status_val, 'compare' => '=');
} else {
    $meta_query[] = array('key' => bon_get_prefix() . 'listing_featured', 'value' => true, 'compare' => '=');
}
if (!empty($agent)) {
    $meta_query[] = array('key' => bon_get_prefix() . 'listing_agentpointed', 'value' => serialize(array(strval($agent))), 'compare' => '=');
}
$tax_query = array();
if ($type_val != '' && $type_val != 'any') {
    $tax_query[] = array('taxonomy' => 'property-type', 'field' => 'slug', 'terms' => $type_val);
}
if ($location_val != '' && $location_val != 'any') {
    $tax_query[] = array('taxonomy' => 'property-location', 'field' => 'slug', 'terms' => $location_val);
}
if (count($tax_query) > 1) {
    $tax_query['relation'] = 'AND';
}
$listing_args = array('post_type' => 'listing', 'posts_per_page' => $numberposts, 'paged' => $paged, 'meta_key' => $key, 'orderby' => $orderby, 'order' => $order, 'suppress_filters' => true, 'meta_query' => $meta_query, 'tax_query' => $tax_query);
$wp_query = new WP_Query($listing_args);
bon_get_template_part('loop', 'listing');
?>
Exemplo n.º 18
0
<?php

$prefix = bon_get_prefix();
$show_agent_details = bon_get_option('show_agent_details', 'yes');
$show_contact_form = bon_get_option('show_contact_form', 'yes');
$agent_ids = get_post_meta($post->ID, $prefix . 'listing_agentpointed', true);
$agent_id = '';
if (is_array($agent_ids) && !empty($agent_ids)) {
    $agent_id = $agent_ids[0];
} else {
    $agent_id = bon_get_option('global_agent');
}
if (!empty($agent_id)) {
    $agent_email = shandora_get_meta($agent_id, 'agentemail');
    if (empty($agent_email)) {
        $agent_email = get_option('admin_email');
    }
    ?>

<footer class="listing-contact row">
	<?php 
    if ($show_agent_details == 'yes') {
        $col_class = 'large-6';
        if ($show_contact_form == 'no') {
            $col_class = 'large-12';
        }
        ?>
		<div class="column <?php 
        echo $col_class;
        ?>
">
Exemplo n.º 19
0
/**
 * Saves the post SEO meta box settings as post metadata.
 *
 * @since 1.2.0
 * @param int $post_id The ID of the current post being saved.
 * @param int $post The post object currently being saved.
 */
function bon_meta_box_post_save_seo($post_id, $post = '')
{
    $prefix = bon_get_prefix();
    /* Fix for attachment save issue in WordPress 3.5. @link http://core.trac.wordpress.org/ticket/21963 */
    if (!is_object($post)) {
        $post = get_post();
    }
    /* Verify the nonce before proceeding. */
    if (!isset($_POST['bon-post-seo']) || !wp_verify_nonce($_POST['bon-post-seo'], basename(__FILE__))) {
        return $post_id;
    }
    $meta = array('Title' => $_POST['bon-document-title'], 'Description' => $_POST['bon-meta-description'], 'Keywords' => $_POST['bon-meta-keywords']);
    foreach ($meta as $meta_key => $new_meta_value) {
        /* Get the meta value of the custom field key. */
        $meta_value = get_post_meta($post_id, $meta_key, true);
        /* If there is no new meta value but an old value exists, delete it. */
        if (current_user_can('delete_post_meta', $post_id, $meta_key) && '' == $new_meta_value && $meta_value) {
            delete_post_meta($post_id, $meta_key, $meta_value);
        } elseif (current_user_can('add_post_meta', $post_id, $meta_key) && $new_meta_value && '' == $meta_value) {
            add_post_meta($post_id, $meta_key, $new_meta_value, true);
        } elseif (current_user_can('edit_post_meta', $post_id, $meta_key) && $new_meta_value && $new_meta_value != $meta_value) {
            update_post_meta($post_id, $meta_key, $new_meta_value);
        }
    }
}
Exemplo n.º 20
0
        $type_query[] = $type->slug;
    }
    $tax_query[] = array('taxonomy' => 'property-type', 'field' => 'slug', 'terms' => $type_query);
}
if ($tax_query && count($tax_query) > 1) {
    $tax_query['relation'] = 'OR';
}
$posts_per_page = 3;
$layout = get_theme_mod('theme_layout');
if (empty($layout)) {
    $layout = get_post_layout(get_queried_object_id());
    if ($layout == '1c') {
        $posts_per_page = 4;
    }
}
$args = array('posts_per_page' => $posts_per_page, 'post_type' => 'listing', 'post_status' => 'publish', 'post__not_in' => (array) $current_post, 'tax_query' => $tax_query, 'meta_query' => array('relation' => 'OR', array('key' => bon_get_prefix() . 'listing_price', 'compare' => 'BETWEEN', 'value' => array($price_min, $price_max), 'type' => 'NUMERIC')));
$related_query = get_posts($args);
if ($related_query) {
    $compare_page = bon_get_option('compare_page');
    ?>
<h3 class="related-property-header"><?php 
    _e('Related Properties', 'bon');
    ?>
</h3>
<hr />
<ul class="listings related <?php 
    shandora_block_grid_column_class();
    ?>
" data-compareurl="<?php 
    echo get_permalink($compare_page);
    ?>
    $orderby = $_GET['search_orderby'];
}
if (isset($_GET['search_order'])) {
    $order = $_GET['search_order'];
}
switch ($orderby) {
    case 'price':
        $orderby = 'meta_value_num';
        $key = bon_get_prefix() . 'listing_price';
        break;
    case 'title':
        $orderby = 'title';
        break;
    case 'size':
        $orderby = 'meta_value_num';
        $key = bon_get_prefix() . 'listing_mileage';
        break;
    default:
        $orderby = 'date';
        break;
}
$search_args['meta_key'] = $key;
$search_args['orderby'] = $orderby;
$search_args['order'] = $order;
// wp query
$wp_query = new WP_Query($search_args);
?>

                <?php 
bon_get_template_part('loop', 'car-listing');
?>
Exemplo n.º 22
0
<?php

global $bonbuilder;
$builder = get_post_meta(get_the_ID(), bon_get_prefix() . 'builder', true);
if ($builder && is_singular(get_post_type())) {
    ?>
	
	<article id="post-<?php 
    the_ID();
    ?>
" <?php 
    post_class();
    ?>
>

		<header class="entry-header">
			<?php 
    echo apply_atomic_shortcode('entry_byline', '<div class="entry-byline">' . __('[entry-icon class="show-for-large"] [entry-author] [entry-published format="M, d Y" text="' . __('Posted on ', 'bon') . '"] [entry-comments-link] [entry-terms taxonomy="category"] [entry-edit-link]', 'bon') . '</div>');
    ?>
		</header><!-- .entry-header -->

		<div class="entry-content clear">
			<?php 
    the_content();
    ?>
			<?php 
    wp_link_pages(array('before' => '<p class="page-links">' . '<span class="before">' . __('Pages:', 'bon') . '</span>', 'after' => '</p>'));
    ?>
		</div><!-- .entry-content -->

		<footer class="entry-footer">
Exemplo n.º 23
0
    /**
     * Outputs the widget based on the arguments input through the widget controls.
     *
     * @since 1.0
     */
    function widget($sidebar, $instance)
    {
        extract($sidebar);
        /* Set the $args for wp_get_archives() to the $instance array. */
        $args = $instance;
        /* Overwrite the $echo argument and set it to false. */
        $args['echo'] = false;
        /* Output the theme's $before_widget wrapper. */
        echo $before_widget;
        /* If a title was input by the user, display it. */
        if (!empty($instance['title'])) {
            echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
        }
        $term = '';
        $tax_query = array();
        $date_query = '';
        if (isset($instance['type']) && isset($instance['location'])) {
            if ($instance['type'] = 'listing') {
                $term = get_term_by('slug', $instance['location'], 'property-location');
            } else {
                if ($instance['type'] = 'car-listing') {
                    $term = get_term_by('slug', $instance['location'], 'dealer-location');
                }
            }
        }
        ?>

		<?php 
        if (!empty($term)) {
            ?>

		<?php 
            if ($instance['scope'] == 'weekly') {
                $date_query = date('Y-m-d', strtotime('-7 days'));
            } else {
                $date_query = date('Y-m-d', strtotime('-30 days'));
            }
            global $wpdb;
            $sold_results = $wpdb->get_results($wpdb->prepare("SELECT status.meta_value lstatus, count(DISTINCT posts.ID) cpost, \n\t\t\t\t\t\tAVG(DISTINCT price.meta_value) avgvalue \n\t\t\t\t\t\tFROM {$wpdb->posts} posts \n\t\t\t\t\t\tINNER JOIN {$wpdb->term_relationships} tr \n\t\t\t\t\t\tON posts.ID = tr.object_id \n\t\t\t\t\t\tINNER JOIN {$wpdb->term_taxonomy} t \n\t\t\t\t\t\tON tr.term_taxonomy_id = t.term_taxonomy_id \n\t\t\t\t\t\tINNER JOIN {$wpdb->postmeta} price \n\t\t\t\t\t\tON posts.ID = price.post_id \n\t\t\t\t\t\tAND price.meta_key = %s \n\t\t\t\t\t\tINNER JOIN {$wpdb->postmeta} status \n\t\t\t\t\t\tON posts.ID = status.post_id \n\t\t\t\t\t\tWHERE tr.term_taxonomy_id IN (%d) \n\t\t\t\t\t\tAND posts.post_type = %s \n\t\t\t\t\t\tAND (posts.post_status = 'publish' OR posts.post_status = 'private') \n\t\t\t\t\t\tAND status.meta_key = %s \n\t\t\t\t\t\tAND status.meta_value = 'sold' \n\t\t\t\t\t\tAND posts.post_modified > %s \n\t\t\t\t\t\tGROUP BY status.meta_value \n\t\t\t\t\t\tORDER BY posts.post_modified DESC\n", bon_get_prefix() . 'listing_price', $term->term_taxonomy_id, $instance['type'], bon_get_prefix() . 'listing_status', $date_query));
            $other_results = $wpdb->get_results($wpdb->prepare("SELECT count(DISTINCT posts.ID) cpost, \n\t\t\t\t\t\tAVG(DISTINCT price.meta_value) avgvalue \n\t\t\t\t\t\tFROM {$wpdb->posts} posts \n\t\t\t\t\t\tINNER JOIN {$wpdb->term_relationships} tr \n\t\t\t\t\t\tON posts.ID = tr.object_id \n\t\t\t\t\t\tINNER JOIN {$wpdb->term_taxonomy} t \n\t\t\t\t\t\tON tr.term_taxonomy_id = t.term_taxonomy_id \n\t\t\t\t\t\tINNER JOIN {$wpdb->postmeta} price \n\t\t\t\t\t\tON posts.ID = price.post_id \n\t\t\t\t\t\tAND price.meta_key = %s \n\t\t\t\t\t\tINNER JOIN {$wpdb->postmeta} status \n\t\t\t\t\t\tON posts.ID = status.post_id \n\t\t\t\t\t\tWHERE tr.term_taxonomy_id IN (%d) \n\t\t\t\t\t\tAND posts.post_type = %s \n\t\t\t\t\t\tAND (posts.post_status = 'publish' OR posts.post_status = 'private') \n\t\t\t\t\t\tAND status.meta_key = %s \n\t\t\t\t\t\tAND ( status.meta_value != 'sold' AND status.meta_value != 'rented' )\n\t\t\t\t\t\tAND posts.post_modified > %s \n\t\t\t\t\t\tORDER BY posts.post_modified DESC\n", bon_get_prefix() . 'listing_price', $term->term_taxonomy_id, $instance['type'], bon_get_prefix() . 'listing_status', $date_query));
            ?>
		<div class="row">
			<div class="column large-12">

				<div class="shandora-sales-stat">
					<div class="shandora-sales-stat-header">
						<h4 class="shandora-sales-stat-location">
							<?php 
            echo $term->name;
            ?>
						</h4>
						<?php 
            if (isset($instance['scope'])) {
                ?>
							<div class="shandora-sales-stat-title">
								<?php 
                if ($instance['scope'] == 'weekly') {
                    _e('Listing over last 7 days', 'bon');
                } else {
                    if ($instance['scope'] == 'monthly') {
                        _e('Listing over last 30 days', 'bon');
                    }
                }
                ?>
							</div>
						<?php 
            }
            ?>
					</div>
					<div class="shandora-sales-stat-content">

						<div class="shandora-sales-stat-avg-price shandora-stat-container">
							<div class="shandora-stat-icon pull-left">
								<i class="bonicons bi-calculator bi-2x bi-fw"></i>
							</div>
							<div class="shandora-stat-value-container">
								<div class="shandora-stat-value"><?php 
            echo shandora_format_price($other_results[0]->avgvalue);
            ?>
</div>
								<div class="shandora-stat-title">
									<?php 
            _e('Listings Avg. Price', 'bon');
            ?>
								</div>
							</div>
						</div>

						<div class="shandora-sales-stat-avg-sold shandora-stat-container">
							<div class="shandora-stat-icon pull-left">
								<i class="bonicons bi-flag bi-2x bi-fw"></i>
							</div>
							<div class="shandora-stat-value-container">
								<div class="shandora-stat-value"><?php 
            echo shandora_format_price($sold_results[0]->avgvalue);
            ?>
</div>
								<div class="shandora-stat-title">
									<?php 
            _e('Listings Avg. Sold Price', 'bon');
            ?>
								</div>
							</div>
						</div>

						<div class="shandora-sales-stat-for-sale shandora-stat-container">
							<div class="shandora-stat-icon pull-left">
								<i class="bonicons bi-home bi-2x bi-fw"></i>
							</div>
							<div class="shandora-stat-value-container">
								<div class="shandora-stat-value"><?php 
            echo $other_results[0]->cpost;
            ?>
</div>
								<div class="shandora-stat-title">
									<?php 
            _e('Listings For Sale', 'bon');
            ?>
								</div>
							</div>
						</div>

						<div class="shandora-sales-stat-sold shandora-stat-container">
							<div class="shandora-stat-icon pull-left">
								<i class="bonicons bi-legal bi-2x bi-fw"></i>
							</div>
							<div class="shandora-stat-value-container">
								<div class="shandora-stat-value"><?php 
            echo $sold_results[0]->cpost;
            ?>
</div>
								<div class="shandora-stat-title">
									<?php 
            _e('Listings Sold', 'bon');
            ?>
								</div>
							</div>
						</div>
					</div>
				</div>

			</div>
		</div>
		<?php 
        }
        ?>

	<?php 
        /* Close the theme's widget wrapper. */
        echo $after_widget;
    }