[listing_search] Shortcode


Insert the Listing Search widget through a shortcode.


[listing_search title="" post_type="property,rental" property_status="current"]

Shortcode Parameters

When using shortcode parameters, their order is important. These are the parameters you can pass to the shortcode and what they do. The defaults for the [listing_search] shortcode are displayed.

'title'				=>	'', 	// Freeform text
'post_type'			=>	'property', // Post type name array comma separated property,land,rental
'style'				=>	'default', 	// Singular: default, wide, slim or fixed
'property_status'		=>	'', 	// Singular: current / sold / leased or '' for any
'search_id'			=>	'off', 	// on or off
'search_location'		=>	'on', 	// on or off
'search_city'			=>	'off', 	// on or off
'search_state'			=>	'off', 	// on or off
'search_postcode'		=>	'off', 	// on or off
'search_country'		=>	'off', 	// on or off
'search_house_category'		=>	'on', 	// on or off
'house_category_multiple'	=>	'off', 	// on or off
'search_price'			=>	'on', 	// on or off
'search_bed'			=>	'on', 	// on or off
'search_bath'			=>	'on', 	// on or off
'search_rooms'			=>	'off', 	// on or off
'search_car'			=>	'off', 	// on or off
'search_land_area'		=>	'off',	// on or off
'search_building_area'		=>	'off',	// on or off
'search_other'			=>	'on',  	// on or off
'submit_label'			=>	'Search' 	// Freeform text

How to place a search bar on your archive page if your theme does not have a widget area.

Some themes may not allow you to add a widget bar above your archive page. Not to worry this is where you can use the template system to add a search bar above your listing archive pages.

Copy the archive-listing.php file from plugins/easy-property-listings/lib/templates/themes/default/ and place it in your theme/child folder. Insert the following before or after the < header > tag depending on where you want to place the search bar.

	<?php echo do_shortcode('[listing_search post_type=property,land,rental style=wide]'); ?>

Or you can create if/else statements for each listing type so that you can specify different shortcode options eg.

if ( is_post_type_archive( 'property' ) ) {
	// Property
	echo do_shortcode('[listing_search post_type=property style=wide]');
} elseif ( is_post_type_archive( 'rental' ) ) {
	// Rental
	echo do_shortcode('[listing_search post_type=rental style=wide]');
} elseif ( is_post_type_archive( 'land' ) ) {
	// Land
	echo do_shortcode('[listing_search post_type=land style=wide]');
} elseif ( is_post_type_archive( 'rural' ) ) {
	// Rural
	echo do_shortcode('[listing_search post_type=rural style=wide]');
} else {
	// Default catch all
	echo do_shortcode('[listing_search post_type=property,land,rental,rural style=wide]');