$terms = get_the_terms($post->ID, "property-type"); if ($terms && !is_wp_error($terms)) { foreach ($terms as $term) { echo '<a class="property-type" href="' . get_term_link($term->slug, "property-type") . '">' . $term->name . '</a>'; break; // to display only one property type } } ?> <?php if (current_theme_supports('get-the-image')) { get_the_image(array('post_id' => $post->ID, 'size' => 'listing_small')); } ?> <?php $status_opt = shandora_get_search_option('status'); ?> <div class="badge <?php echo $status; ?> "><span><?php if ($status != 'none') { if (array_key_exists($status, $status_opt)) { echo $status_opt[$status]; } } ?> </span></div> </header><!-- .entry-header -->
function shandora_setup_listing_post_type() { global $bon; $prefix = bon_get_prefix(); $suffix = SHANDORA_MB_SUFFIX; $cpt = $bon->cpt(); $use_rewrite = bon_get_option('use_rewrite', 'no'); $settings = array(); $slug = ''; $settings['rewrite_root'] = bon_get_option('rewrite_root'); $settings['realestate_root'] = bon_get_option('realestate_root', 'real-estate'); $settings['realestate_property_type_root'] = bon_get_option('realestate_property_type_root', 'manufacturer'); $settings['realestate_property_location_root'] = bon_get_option('realestate_property_location_root', 'body-type'); $settings['realestate_property_feature_root'] = bon_get_option('realestate_property_feature_root', 'dealer-location'); if (!empty($settings['rewrite_root'])) { $slug = "{$settings['rewrite_root']}/{$settings['realestate_root']}"; } else { $slug = "{$settings['realestate_root']}"; } $property_type_slug = "{$settings['realestate_root']}/{$settings['realestate_property_type_root']}"; $property_location_slug = "{$settings['realestate_root']}/{$settings['realestate_property_location_root']}"; $property_feature_slug = "{$settings['realestate_root']}/{$settings['realestate_property_feature_root']}"; $has_archive = $use_rewrite == 'no' ? false : $slug; $rewrite_var = array('slug' => $slug, 'with_front' => false, 'pages' => true, 'feeds' => true, 'ep_mask' => EP_PERMALINK); $rewrite = $use_rewrite == 'no' ? true : $rewrite_var; $name = __('Listing', 'bon'); $plural = __('Listings', 'bon'); $args = array('has_archive' => $has_archive, 'rewrite' => $rewrite, 'supports' => array('editor', 'title', 'excerpt', 'thumbnail', 'front-end-editor'), 'menu_position' => 6); $cpt->create('Listing', $args, array(), $name, $plural); $gallery_opts = array(array('label' => __('Listings Gallery', 'bon'), 'desc' => __('Choose image to use in this listing gallery.', 'bon'), 'id' => $prefix . $suffix . 'gallery', 'type' => 'gallery')); $prop_options = array(array('label' => __('MLS Number', 'bon'), 'desc' => __('The property MLS Number #', 'bon'), 'id' => $prefix . $suffix . 'mls', 'type' => 'text'), array('label' => __('Property Status', 'bon'), 'desc' => __('The status for the property, used for badge, etc.', 'bon'), 'id' => $prefix . $suffix . 'status', 'type' => 'select', 'options' => shandora_get_search_option()), array('label' => __('For Rent Period', 'bon'), 'desc' => __('Choose the period for the rent. Only show if status is for rent.', 'bon'), 'id' => $prefix . $suffix . 'period', 'type' => 'select', 'options' => shandora_get_search_option('period')), array('label' => __('Show Period on Price', 'bon'), 'desc' => __('Always show the period after price for all property status except sale and sold status.', 'bon'), 'id' => $prefix . $suffix . 'show_period', 'type' => 'select', 'options' => array('no' => __('No', 'bon'), 'yes' => __('Yes', 'bon'))), array('label' => __('Address', 'bon'), 'desc' => __('The Property Address.', 'bon'), 'id' => $prefix . $suffix . 'address', 'type' => 'textarea'), array('label' => __('Zip Postal', 'bon'), 'desc' => __('Address Zip Postal', 'bon'), 'id' => $prefix . $suffix . 'zip', 'type' => 'text'), array('label' => __('Price', 'bon'), 'desc' => __('The Property Price. Fill with numeric only, eq: 123456', 'bon'), 'id' => $prefix . $suffix . 'price', 'type' => 'text'), array('label' => __('Secondary Price', 'bon'), 'desc' => __('The Secondary Price eq. price without tax. Fill with numeric only, eq: 123456', 'bon'), 'id' => $prefix . $suffix . 'price_sec', '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' => __('Bed Rooms', 'bon'), 'desc' => __('How Many Bedroom? Fill with numeric only', 'bon'), 'id' => $prefix . $suffix . 'bed', 'type' => 'text'), array('label' => __('Bath Rooms', 'bon'), 'desc' => __('How Many Bathroom? Fill with numeric only', 'bon'), 'id' => $prefix . $suffix . 'bath', 'type' => 'text'), array('label' => __('Garage', 'bon'), 'desc' => __('How Many Garage? Fill with numeric only', 'bon'), 'id' => $prefix . $suffix . 'garage', 'type' => 'text'), array('label' => __('Basement', 'bon'), 'desc' => __('How many basement?', 'bon'), 'id' => $prefix . $suffix . 'basement', 'type' => 'text'), array('label' => __('Floors / Stories', 'bon'), 'desc' => __('The total floors or stories.', 'bon'), 'id' => $prefix . $suffix . 'floor', 'type' => 'text'), array('label' => __('Total Rooms', 'bon'), 'desc' => __('The total rooms. Fill with numeric only', 'bon'), 'id' => $prefix . $suffix . 'totalroom', 'type' => 'text'), array('label' => __('Lot Size', 'bon'), 'desc' => __('The Lot Size', 'bon'), 'id' => $prefix . $suffix . 'lotsize', 'type' => 'text'), array('label' => __('Building Size', 'bon'), 'desc' => __('The Building Size', 'bon'), 'id' => $prefix . $suffix . 'buildingsize', 'type' => 'text'), array('label' => __('Furnishing', 'bon'), 'desc' => __('The Property is Furnished or unfurnised?', 'bon'), 'id' => $prefix . $suffix . 'furnishing', 'type' => 'select', 'options' => shandora_get_search_option('furnishing')), array('label' => __('Mortgage Availability', 'bon'), 'desc' => __('The Property is Available for mortgage or not?', 'bon'), 'id' => $prefix . $suffix . 'mortgage', 'type' => 'select', 'options' => shandora_get_search_option('mortgage')), array('label' => __('Date of Availability', 'bon'), 'desc' => __('When is the property available?', 'bon'), 'id' => $prefix . $suffix . 'dateavail', 'type' => 'date'), array('label' => __('Year Built', 'bon'), 'desc' => __('When is the property build? eq: 2013', 'bon'), 'id' => $prefix . $suffix . 'yearbuild', 'type' => 'text'), array('label' => __('Map Latitude', 'bon'), 'desc' => __('The Map Latitude. You can easily find it <a href="http://www.itouchmap.com/latlong.html">here</a>. Copy and paste the latitude value generated there', 'bon'), 'id' => $prefix . $suffix . 'maplatitude', 'type' => 'text'), array('label' => __('Map Longitude', 'bon'), 'desc' => __('The Map Longitude. You can easily find it <a href="http://www.itouchmap.com/latlong.html">here</a>. Copy and paste the longitude value generated there', 'bon'), 'id' => $prefix . $suffix . 'maplongitude', 'type' => 'text'), array('label' => __('Featured Property', 'bon'), 'desc' => __('Make the property featured for featured property widget', 'bon'), 'id' => $prefix . $suffix . 'featured', 'type' => 'checkbox'), array('label' => __('Agent for this listing', 'bon'), 'desc' => __('The agent pointed for this property listing', 'bon'), 'id' => $prefix . $suffix . 'agentpointed', 'type' => 'old_post_select', 'post_type' => 'agent')); $fr_opt = array(); if (bon_get_option('enable_dpe_ges', false) == 'yes') { $fr_opt[] = array('label' => __('DPE', 'bon'), 'desc' => __('Diagnostic de Performance énergétiqueg', 'bon'), 'id' => $prefix . $suffix . 'dpe', 'type' => 'number'); $fr_opt[] = array('label' => __('GES', 'bon'), 'desc' => __('Gaz à effet de serre', 'bon'), 'id' => $prefix . $suffix . 'ges', 'type' => 'number'); } $prop_options = array_merge($fr_opt, $prop_options); /* The rewrite handles the URL structure. */ $property_type_rewrite_var = array('slug' => $property_type_slug, 'with_front' => false, 'hierarchical' => false, 'ep_mask' => EP_NONE); /* The rewrite handles the URL structure. */ $property_location_rewrite_var = array('slug' => $property_location_slug, 'with_front' => false, 'hierarchical' => true, 'ep_mask' => EP_NONE); /* The rewrite handles the URL structure. */ $property_feature_rewrite_var = array('slug' => $property_feature_slug, 'with_front' => false, 'hierarchical' => false, 'ep_mask' => EP_NONE); if ($use_rewrite == 'no') { $property_feature_rewrite = true; $property_location_rewrite = true; $property_type_rewrite = true; } else { $property_feature_rewrite = $property_feature_rewrite_var; $property_location_rewrite = $property_location_rewrite_var; $property_type_rewrite = $property_type_rewrite_var; } $cpt->add_taxonomy("Property Type", array('rewrite' => $property_type_rewrite, 'hierarchical' => true, 'label' => __('Property Types', 'bon'), 'labels' => array('menu_name' => __('Types', 'bon')))); $cpt->add_taxonomy("Property Location", array('rewrite' => $property_location_rewrite, 'hierarchical' => true, 'label' => __('Property Locations', 'bon'), 'labels' => array('menu_name' => __('Locations', 'bon')))); $cpt->add_taxonomy("Property Feature", array('rewrite' => $property_feature_rewrite, 'label' => __('Property Features', 'bon'), 'labels' => array('menu_name' => __('Features', 'bon')))); do_action("shandora_property_taxonomy", $cpt); $cpt->add_meta_box('gallery-options', __('Gallery Options', 'bon'), $gallery_opts); $cpt->add_meta_box('property-options', __('Property Options', 'bon'), $prop_options); $cpt->add_meta_box('video-options', __('Video Options', 'bon'), shandora_video_metabox_args()); do_action("shandora_property_metabox", $cpt); }
function shandora_manage_columns($name) { global $post; switch ($name) { case 'status': $s_opt = shandora_get_search_option('status'); $status = shandora_get_meta($post->ID, 'listing_status'); if (array_key_exists($status, $s_opt)) { $status = $s_opt[$status]; } echo $status; break; case 'car_status': $s_opt = shandora_get_car_search_option('status'); $status = shandora_get_meta($post->ID, 'listing_status'); if (array_key_exists($status, $s_opt)) { $status = $s_opt[$status]; } echo $status; break; case 'yearbuilt': $year = shandora_get_meta($post->ID, 'listing_yearbuild'); echo $year; break; case 'price': $price = shandora_get_meta($post->ID, 'listing_price', true); echo $price; break; case 'propertylocation': $location = get_the_term_list($post->ID, 'property-location', '', ', ', ''); echo $location; break; case 'propertytype': $type = get_the_term_list($post->ID, 'property-type', '', ', ', ''); echo $type; break; case 'bodytype': $type = get_the_term_list($post->ID, 'body-type', '', ', ', ''); echo $type; break; } }
/** * Used to output property location field in search panel * * @since 1.0.6 * @return string * @param string $value * */ function shandora_search_location_level1_field($value = array(), $class, $is_widget = false) { $o = apply_atomic('search_location_level1_field', '', $value, $class, $is_widget); if ($o != '') { return $o; } global $bon; $form = $bon->form(); $o = $form->form_label(bon_get_option('location_level1_label'), 'property_location'); $o .= $form->form_dropdown('property_location_level1', shandora_get_search_option('location1'), $value['property_location_level1'], 'class=" ' . $class . '"'); return apply_atomic('search_location_level1_field_output', $o); }
function shandora_builder_options_filter($args) { $prefix = bon_get_prefix(); if (function_exists('bon_toolkit_get_builder_suffix')) { $suffix = bon_toolkit_get_builder_suffix(); } else { $suffix = ''; } $options_car = bon_get_option('enable_car_listing', 'no'); $agentopt = bon_get_post_id_lists('agent'); $salesopt = bon_get_post_id_lists('sales-representative'); $list_property_type = bon_get_categories('property-type'); $list_body = bon_get_categories('body-type'); $list_dealer_loc = bon_get_categories('dealer-location'); $list_manufacturer = bon_get_categories('manufacturer'); $list_car_feature = bon_get_categories('car-feature'); $list_loc = bon_get_categories('property-location'); $list_features = bon_get_categories('property-feature'); if (isset($args['elements']['post'])) { unset($args['elements']['post']); } $prop_query = array('latest' => __('Latest', 'bon'), 'featured' => __('Featured', 'bon')); $list_cat = bon_get_categories('category'); $prop_query = array_merge($prop_query, shandora_get_search_option('status')); $args['elements']['post_carousel'] = array('header' => array('title' => __('Title', 'bon'), 'name' => $prefix . 'builder_post_carousel_text', 'type' => 'text'), 'numberposts' => array('title' => __('Number of Posts to Fetch', 'bon'), 'name' => $prefix . 'builder_post_carousel_numberposts', 'type' => 'text'), 'category' => array('title' => __('Category', 'bon'), 'name' => $prefix . 'builder_post_carousel_category', 'type' => 'select', 'options' => $list_cat), 'button_color' => array('title' => __('Button Color', 'bon'), 'name' => $prefix . 'builder_button_color', 'type' => 'select', 'options' => array('red' => __('Red', 'bon'), 'blue' => __('Blue', 'bon'), 'green' => __('Green', 'bon'), 'purple' => __('Purple', 'bon'), 'orange' => __('Orange', 'bon'))), 'margin' => array('title' => __('Bottom Margin', 'bon'), 'name' => $prefix . 'builder_post_carousel_margin', 'std' => '0', 'hr' => 'none', 'type' => 'text'), 'default_size' => 'span12', 'allowed_size' => array('span12' => '1/1')); $args['elements']['listings'] = array('numberposts' => array('title' => __('Number of Posts to Fetch', 'bon'), 'name' => $prefix . 'builder_listings_numberposts', 'type' => 'text'), 'property_id' => array('title' => __('Query by ID (Separate by comma eq. 1,2,3)', 'bon'), 'name' => $prefix . 'builder_listings_id', 'type' => 'text'), 'property_type' => array('title' => __('Property Type', 'bon'), 'name' => $prefix . 'builder_listings_cat', 'type' => 'select', 'options' => $list_property_type), 'property_location' => array('title' => __('Property Location', 'bon'), 'name' => $prefix . 'builder_listings_location', 'type' => 'select', 'options' => $list_loc), 'property_feature' => array('title' => __('Property Feature', 'bon'), 'name' => $prefix . 'builder_listings_features', 'type' => 'select', 'options' => $list_features), 'property_query' => array('title' => __('Property Query', 'bon'), 'name' => $prefix . 'builder_listings_query', 'type' => 'select', 'options' => $prop_query), 'show_map' => array('title' => __('Show Map', 'bon'), 'name' => $prefix . 'builder_listings_map', 'type' => 'select', 'options' => array('no' => __('No', 'bon'), 'yes' => __('Yes', 'bon'))), 'margin' => array('title' => __('Bottom Margin', 'bon'), 'name' => $prefix . 'builder_listings_margin', 'std' => '0', 'hr' => 'none', 'type' => 'text'), 'default_size' => 'span12', 'allowed_size' => array('span12' => '1/1')); $args['elements']['agent'] = array('header' => array('title' => __('Title', 'bon'), 'name' => $prefix . 'builder_agent_title', 'type' => 'text'), 'agent_id' => array('title' => __('Pick Agent', 'bon'), 'name' => $prefix . 'builder_agent_id', 'type' => 'select', 'options' => $agentopt), 'color' => array('title' => __('Background Color', 'bon'), 'name' => $prefix . 'builder_agent_color', 'type' => 'select', 'options' => array('blue' => __('Blue', 'bon'), 'red' => __('Red', 'bon'), 'green' => __('Green', 'bon'), 'orange' => __('Orange', 'bon'), 'yellow' => __('Yellow', 'bon'), 'purple' => __('Purple', 'bon'))), 'margin' => array('title' => __('Bottom Margin', 'bon'), 'name' => $prefix . 'builder_agent_margin', 'std' => '0', 'hr' => 'none', 'type' => 'text'), 'default_size' => 'span3', 'allowed_size' => array('span3' => '1/4', 'span4' => '1/3', 'span6' => '1/2', 'span8' => '2/3', 'span9' => '3/4', 'span12' => '1/1')); if ($options_car == 'yes') { $car_query = array('latest' => __('Latest', 'bon'), 'featured' => __('Featured', 'bon')); $car_query = array_merge($car_query, shandora_get_car_search_option('status')); $args['elements']['car_listings'] = array('numberposts' => array('title' => __('Number of Posts to Fetch', 'bon'), 'name' => $prefix . 'builder_car_listings_numberposts', 'type' => 'text'), 'car_id' => array('title' => __('Query by ID (Separate by comma eq. 1,2,3)', 'bon'), 'name' => $prefix . 'builder_car_listings_id', 'type' => 'text'), 'body_type' => array('title' => __('Body Type', 'bon'), 'name' => $prefix . 'builder_car_listings_cat', 'type' => 'select', 'options' => $list_body), 'dealer_location' => array('title' => __('Dealer Location', 'bon'), 'name' => $prefix . 'builder_car_listings_location', 'type' => 'select', 'options' => $list_dealer_loc), 'car_feature' => array('title' => __('Car Feature', 'bon'), 'name' => $prefix . 'builder_car_listings_features', 'type' => 'select', 'options' => $list_car_feature), 'car_query' => array('title' => __('Car Query', 'bon'), 'name' => $prefix . 'builder_car_listings_query', 'type' => 'select', 'options' => $car_query), 'manufacturer' => array('title' => __('Manufacturer', 'bon'), 'name' => $prefix . 'builder_car_listings_manufacturers', 'type' => 'select', 'options' => $list_manufacturer), 'margin' => array('title' => __('Bottom Margin', 'bon'), 'name' => $prefix . 'builder_car_listings_margin', 'std' => '0', 'hr' => 'none', 'type' => 'text'), 'default_size' => 'span12', 'allowed_size' => array('span12' => '1/1')); $args['elements']['sales_rep'] = array('header' => array('title' => __('Title', 'bon'), 'name' => $prefix . 'builder_sales_rep_title', 'type' => 'text'), 'agent_id' => array('title' => __('Pick Sales Rep', 'bon'), 'name' => $prefix . 'builder_sales_rep_id', 'type' => 'select', 'options' => $salesopt), 'color' => array('title' => __('Background Color', 'bon'), 'name' => $prefix . 'builder_sales_rep_color', 'type' => 'select', 'options' => array('blue' => __('Blue', 'bon'), 'red' => __('Red', 'bon'), 'green' => __('Green', 'bon'), 'orange' => __('Orange', 'bon'))), 'margin' => array('title' => __('Bottom Margin', 'bon'), 'name' => $prefix . 'builder_sales_rep_margin', 'std' => '0', 'hr' => 'none', 'type' => 'text'), 'default_size' => 'span3', 'allowed_size' => array('span3' => '1/4', 'span4' => '1/3', 'span6' => '1/2', 'span8' => '2/3', 'span9' => '3/4', 'span12' => '1/1')); } return $args; }