Esempio n. 1
0
 function wpsight_search_form_details()
 {
     $standard_details = wpsight_standard_details();
     $search_details = array('status' => array('label' => __('Status', 'wpsight'), 'key' => '_price_status', 'data' => wpsight_listing_statuses(), 'type' => 'select', 'data_compare' => '=', 'data_type' => false, 'default' => false, 'advanced' => false, 'position' => 10), 'location' => array('label' => __('Location', 'wpsight'), 'taxonomy' => 'location', 'data' => array('dropdown' => true), 'type' => 'taxonomy', 'data_compare' => false, 'data_type' => false, 'default' => false, 'advanced' => false, 'position' => 20), 'listing-type' => array('label' => __('Type', 'wpsight'), 'taxonomy' => 'listing-type', 'data' => array('dropdown' => true), 'type' => 'taxonomy', 'data_compare' => false, 'data_type' => false, 'default' => false, 'advanced' => false, 'position' => 30), $standard_details['details_1']['id'] => array('label' => $standard_details['details_1']['label'], 'key' => '_details_1', 'type' => 'text', 'data_compare' => '=', 'data_type' => false, 'default' => false, 'advanced' => false, 'position' => 40), $standard_details['details_2']['id'] => array('label' => $standard_details['details_2']['label'], 'key' => '_details_2', 'type' => 'text', 'data_compare' => '=', 'data_type' => false, 'default' => false, 'advanced' => false, 'position' => 50), 'min' => array('label' => __('Price (min)', 'wpsight'), 'key' => '_price', 'type' => 'text', 'data_compare' => '>=', 'data_type' => 'numeric', 'default' => false, 'advanced' => true, 'position' => 60), 'max' => array('label' => __('Price (max)', 'wpsight'), 'key' => '_price', 'type' => 'text', 'data_compare' => '<=', 'data_type' => 'numeric', 'default' => false, 'advanced' => true, 'position' => 70), 'orderby' => array('label' => __('Order by', 'wpsight'), 'key' => false, 'data_compare' => false, 'data_type' => false, 'type' => 'radio', 'data' => array('date' => __('Date', 'wpsight'), 'price' => __('Price', 'wpsight'), 'title' => __('Title', 'wpsight')), 'default' => 'date', 'advanced' => true, 'position' => 80), 'order' => array('label' => __('Order', 'wpsight'), 'key' => false, 'data_compare' => false, 'data_type' => false, 'type' => 'radio', 'data' => array('asc' => __('asc', 'wpsight'), 'desc' => __('desc', 'wpsight')), 'default' => 'desc', 'advanced' => true, 'position' => 90));
     // Apply filter to array
     $search_details = apply_filters('wpsight_search_form_details', $search_details);
     // Sort array by position
     $search_details = wpsight_sort_array_by_position($search_details);
     // Return filtrable array
     return $search_details;
 }
Esempio n. 2
0
function wpsight_restrict_manage_posts_status()
{
    global $wpdb, $typenow;
    if ($typenow != wpsight_listing_post_type()) {
        return;
    }
    $statuses = wpsight_listing_statuses();
    ?>

	<select name="wpsight-status">
		<option value=""><?php 
    _e('Statuses', 'wpsight');
    ?>
</option><?php 
    $current = isset($_GET['wpsight-status']) ? $_GET['wpsight-status'] : false;
    foreach ($statuses as $status => $label) {
        echo '<option value="' . $status . '"' . selected($status, $current, false) . '>' . $label . '</option>';
    }
    ?>

		<option value="soldrented"<?php 
    selected('soldrented', $current);
    ?>
><?php 
    echo __('Sold', 'wpsight') . ' / ' . __('Rented', 'wpsight');
    ?>
</option>
	</select><?php 
}
Esempio n. 3
0
/**  
 *	Function to create subpages' filter options
 *
 *	@author anhbp
 */
function custom_subpages_filter_form_details()
{
    $standard_details = wpsight_standard_details();
    $search_details = array('status' => array('label' => __('Status', 'wpsight'), 'key' => '_price_status', 'data' => wpsight_listing_statuses(), 'type' => 'select', 'data_compare' => '=', 'data_type' => false, 'default' => false, 'advanced' => false, 'position' => 10), $standard_details['details_1']['id'] => array('label' => $standard_details['details_1']['label'], 'key' => '_details_1', 'type' => 'text', 'data_compare' => '=', 'data_type' => false, 'default' => false, 'advanced' => false, 'position' => 40), $standard_details['details_2']['id'] => array('label' => $standard_details['details_2']['label'], 'key' => '_details_2', 'type' => 'text', 'data_compare' => '=', 'data_type' => false, 'default' => false, 'advanced' => false, 'position' => 50), 'min' => array('label' => __('Price (min)', 'wpsight'), 'key' => '_price', 'type' => 'number', 'data_compare' => '>=', 'data_type' => 'numeric', 'default' => false, 'advanced' => false, 'position' => 55), 'max' => array('label' => __('Price (max)', 'wpsight'), 'key' => '_price', 'type' => 'number', 'data_compare' => '<=', 'data_type' => 'numeric', 'default' => false, 'advanced' => false, 'position' => 60), 'minsize' => array('label' => __('Min sqm', 'wpsight'), 'key' => '_details_3', 'type' => 'number', 'data_compare' => '>=', 'data_type' => 'numeric', 'default' => false, 'advanced' => false, 'position' => 70));
    // Apply filter to array
    $search_details = apply_filters('wpsight_search_form_details', $search_details);
    // Sort array by position
    $search_details = wpsight_sort_array_by_position($search_details);
    if (isset($search_details['property-type'])) {
        unset($search_details['property-type']);
    }
    // Return filtrable array
    return $search_details;
}
Esempio n. 4
0
 */
// Save parent page ID
$parent_id = get_the_ID();
// Make sure paging works
if (get_query_var('paged')) {
    $paged = get_query_var('paged');
} elseif (get_query_var('page')) {
    $paged = get_query_var('page');
} else {
    $paged = 1;
}
// Set args for listings custom query
$args = array('post_type' => array(wpsight_listing_post_type()), 'posts_per_page' => 12, 'paged' => $paged);
// Check if custom field listing_filter
$filter = get_post_meta($parent_id, 'listing_filter', true);
foreach (wpsight_listing_statuses() as $k => $v) {
    if ($filter == $k) {
        $meta_query = array(array('key' => '_price_status', 'value' => $k));
    }
}
// When filter merge with other $args
if (!empty($meta_query)) {
    $args = array_merge($args, array('meta_query' => $meta_query));
}
// Set order args for global query
$order = array('orderby' => get_query_var('orderby'), 'order' => get_query_var('order'));
// Set orderby price if set
if (get_query_var('orderby') == 'price') {
    $order['orderby'] = 'meta_value_num';
    $order['meta_key'] = '_price';
}
Esempio n. 5
0
/**
 * Get listing status value from status key
 *
 * @since 1.0
 */
function wpsight_get_listing_status($status)
{
    $listing_statuses = wpsight_listing_statuses();
    return $listing_statuses[$status];
}
Esempio n. 6
0
 function wpsight_meta_box_listing_price()
 {
     // Listing price labels
     $labels_price = array('title' => __('Listing Price', 'wpsight'), 'price' => __('Price', 'wpsight'), 'price_note' => __('No currency symbols or thousands separators', 'wpsight'), 'status' => __('Status', 'wpsight'), 'period' => __('Period', 'wpsight'), 'availability' => __('Availability', 'wpsight'), 'not_available' => __('Item is no longer available', 'wpsight'));
     $labels_price = apply_filters('wpsight_listing_price_labels', $labels_price);
     // Set meta box
     $meta_box = array('id' => 'listing_price', 'title' => $labels_price['title'], 'pages' => array(wpsight_listing_post_type()), 'context' => 'normal', 'priority' => 'high', 'fields' => array('price' => array('name' => $labels_price['price'], 'id' => '_price', 'type' => 'text', 'desc' => $labels_price['price_note']), 'status' => array('name' => $labels_price['status'], 'id' => '_price_status', 'type' => 'select', 'options' => wpsight_listing_statuses()), 'period' => array('name' => $labels_price['period'], 'id' => '_price_period', 'type' => 'radio', 'options' => array_merge(array('' => __('None', 'wpsight')), wpsight_rental_periods())), 'availability' => array('name' => $labels_price['availability'], 'id' => '_price_sold_rented', 'type' => 'checkbox', 'desc' => $labels_price['not_available'])));
     // Apply filter to array
     $meta_box = apply_filters('wpsight_meta_box_listing_price', $meta_box);
     return $meta_box;
 }