100, 'height' => 0, 'placeholder_img' => PLS_IMG_URL . "/null/listing-100x100.png", 'context' => '', 'context_var' => false, /** Placester API arguments. */ 'limit' => 5, 'sort_type' => 'asc', ); /** Merge the arguments with the defaults. */ $args = wp_parse_args( $args, $defaults ); /** Process arguments that need to be sent to the API. */ $request_params = PLS_Plugin_API::get_valid_property_list_fields( $args ); /** Extract the arguments after they merged with the defaults. */ extract( $args, EXTR_SKIP ); /** Sanitize the width. */ if ( $width ) $width = absint( $width ); /** Sanitize the height. */ if ( $height ) $height = absint( $height ); /** Filter the request parameters. */ $request_params = apply_filters( pls_get_merged_strings( array( 'pls_listings_request', $context ), '_', 'pre', false ), $request_params, $context_var ); /** Request the list of properties. */ $listings_raw = PLS_Plugin_API::get_property_list( $request_params ); /** Display a placeholder if the plugin is not active or there is no API key. */ if ( pls_has_plugin_error() && current_user_can( 'administrator' ) ) return pls_get_no_plugin_placeholder( pls_get_merged_strings( array( $context, __FUNCTION__ ), ' -> ', 'post', false ) ); /** Return nothing when no plugin and user is not admin. */ if ( pls_has_plugin_error() ) return NULL; /** Define variable which will contain the html string with the listings. */ $return = ''; /** Set the listing image attributes. */ $listing_img_attr = array(); if ( $width ) $listing_img_attr['width'] = $width; if ( $height ) $listing_img_attr['height'] = $height; /** Collect the html for each listing. */ $listings_html = array(); foreach ( $listings_raw->properties as $listing_data ) { /** * Curate the listing_data. */ /** Overwrite the placester url with the local url. */ $listing_data->url = PLS_Plugin_API::get_property_url( $listing_data->id ); /** Use the placeholder image if the property has no photo. */ if ( empty( $listing_data->images ) ) { $listing_data->images[0]->url = $placeholder_img; $listing_data->images[0]->order = 0; } /** Remove the ID for each image (not needed by theme developers) and add the image html. */ foreach ( $listing_data->images as $image ) { unset( $image->id ); $image->html = pls_h_img( $image->url, $listing_data->location->full_address, $listing_img_attr ); } ob_start(); ?>
Beds: bedrooms; ?>
Baths: bathrooms; ?>
Half Baths: half_baths; ?>
Price: price; ?>
Available On: available_on; ?>