Advanced Usage
The features stated below can be accessed on the settings tab of the plugin.
Basic Custom Search Form
Copy and paste the code below to get the base structure of an external search form.
html
<form method="GET" action="change-it-to-main-listing-page">
Sort: <input type="text" name="sort" value="lpd">
Default View: <input type="text" name="selected_view" value="grid">
Current Page: <input type="text" name="current_page" value="1">
Listings Per Page: <input type="text" name="show" value="12">
Show Featured Only: <input type="text" name="featured_only" value="0">
Cities <br />
<select name="cities[]" multiple="true">
<option>Auburn</option>
<option>Boca Raton</option>
</select> <br />
Property Statuses <br />
<input type="checkbox" name="status[]" id="status_pending" value="pending" checked="checked"> pending
<input type="checkbox" name="status[]" id="status_sold" value="sold" checked="checked"> sold
Property Types <br />
<input type="checkbox" name="type[]" id="type_commercial" value="commercial" checked="checked"> commercial
<input type="checkbox" name="type[]" id="type_condo-coop" value="condo-coop" checked="checked"> condo-coop
Property Features <br />
<input type="checkbox" name="feature[]" id="feature_basement" value="basement" checked="checked"> basement
<input type="checkbox" name="feature[]" id="feature_fireplace" value="fireplace" checked="checked"> fireplace
Property States <br />
<input type="checkbox" name="state[]" id="state_florida" value="florida" checked="checked"> florida
<input type="checkbox" name="state[]" id="state_alaska" value="alaska" checked="checked"> alaska
Neighborhoods <br />
<input type="checkbox" name="neighborhood[]" id="neighborhood_1268" value="1268" checked="checked"> 1268
<input type="checkbox" name="neighborhood[]" id="neighborhood_1260" value="1260" checked="checked"> 1260
Min Price: <input name="min_price" type="text" value="0">
Max Price: <input name="max_price" type="text" value="1000000000">
Bedrooms:
<select name="bedrooms">
<option value="">Any</option>
<option value="1">1+</option>
<option value="2">2+</option>
<option value="3">3+</option>
<option value="4">4+</option>
<option value="5">5+</option>
</select>
Bathrooms:
<select name="bathrooms">
<option value="">Any</option>
<option value="1">1+</option>
<option value="2">2+</option>
<option value="3">3+</option>
<option value="4">4+</option>
<option value="5">5+</option>
</select>
<input type="submit" value="Search Button">
</form>
Create Custom Theme
This feature of the plugin allows developers to add theme on the plugin by adding files on the theme.
Step 1. Set Up a Custom Template Directory
- Create a folder inside your activated theme and name it
listings-templates
Step 2. Replicate Plugin Folder Structure
- Follow the folder structure found inside the listing plugin directory - aios-listings/templates
Note
To be able for the templates to work, the folder structure needs to be followed strictly.
Step 3. Add Specific Template Folder
- Assuming that you have already identify which template you want to create and let say it’s the details page. You need to add details-page folder inside aios-listings/templates in your theme.
Step 4. Copy Default Template Files
- Copy and paste aios-listings/templates/details-page/default to your theme wp-conten/theme/your-active-theme/aios-listings/templates/details-page/default .
Step 5. Modify Template Functionality
- On wp-conten/theme/your-active-theme/aios-listings/templates/details-page/default/function.php change the className name and slowly start changing the resources required to run your custom listing theme.
Your custom theme folder structure should look like this.
Plugin Template API
This feature of the plugin can be used to easily have access to listing data when in custom templates. See the sample codes below.
Details Page:
php
use \AIOS\Listings\classNameses\aios_template_api;
$listing = aios_template_api::details_page({listingID}); //Get Listing Information
get_header();
echo $listing; //JSON Format
/*
* Custom Layout here
*/
get_footer();
Search Results Page:
php
use \AIOS\Listings\classNameses\aios_template_api;
$limit=12;
$currentPage=1;
$args = [
'meta' => [
'minPrice' => 0,
'maxPrice' => 10000000,
'beds' => 0,
'baths' => 0,
'featured_only' => 0,
'neighborhood' => [1268, 1260]
],
'tax' => [
'relation' => 'AND',
[
'relation' => 'OR',
[
'taxonomy' => 'property-statuses',
'field' => 'slug',
'terms' => 'pending',
],
[
'taxonomy' => 'property-statuses',
'field' => 'slug',
'terms' => 'sold',
]
],
[
'relation' => 'OR',
[
'taxonomy' => 'property-features',
'field' => 'slug',
'terms' => 'basement',
],
[
'taxonomy' => 'property-features',
'field' => 'slug',
'terms' => 'fireplace',
]
],
[
'relation' => 'OR',
[
'taxonomy' => 'property-types',
'field' => 'slug',
'terms' => 'commercial',
],
[
'taxonomy' => 'property-types',
'field' => 'slug',
'terms' => 'condo-coop',
]
],
[
'relation' => 'OR',
[
'taxonomy' => 'property-states',
'field' => 'slug',
'terms' => 'florida',
],
[
'taxonomy' => 'property-states',
'field' => 'slug',
'terms' => 'alaska',
]
]
],
'sort' => 'lpd'
];
$listings = aios_template_api::query($limit, $currentPage, $args);
/*
* Template Name: Custom Listing Template
*/
get_header();
echo $listings; //JSON Format
/*
* Custom Layout here
*/
get_footer();
URL Parameters
This is a sample url query to generate search results.
php
http://localhost/developments/wordpress-development/{assigned-main-page}?min_price=10000&max_price=1000000&neighborhood[]=&neighborhood[]=&state[]=florida&state[]=alaska&feature[]=basement&feature[]=fireplace&status[]=pending&status[]=sold&type[]=commercial&type[]=condo-coop
Parameters Definition of each parameters.
Param | Description |
---|---|
lid[] | Listing IDs. (Array / Default: null) |
min_price | Minimum List Price. (Integer / Default: 0) |
max_price | Maximum List Price. (Integer / Default: 10000000000) |
bedrooms | Listing bedroom count. (Integer / Default: null) |
bathrooms | Listing bathroom count. (Integer / Default: null) |
neighborhood[] | ID of Listing Neighborhood. (Array / Default: null) |
state[] | Slug of Listing state. (Array / Default: null) |
featur[] | Slug of Listing feature. (Array / Default: null) |
status[] | Slug of Listing status. (Array / Default: null) |
type[] | Slug of Listing property type. (Array / Default: null) |
address | Full Address of the property. (String / Default: null) |
selected_view | Listings Page Default View. (String / Default: grid / Select between grid, list, table) |
current_page | Current Listing page in pagination. (Integer / Default: 1) |
show | Total number of Listings being showed per page. (Integer / Default: 12) |
sort | Listing Page default sorting. (String / Default: lpd / Select between lpd (Price High to Low), lpa (Price Low to High), mr (Listed Date Descending)) |
featured_only | Show Featured Listings Only (Integer / Default: 0 / 1 = featured only) |
Last updated on