Updated on September 06, 2018
Scenario: You have registered a 'Types' taxonomy, added two terms named 'For Sale' and 'For Rent', then categorized your listings accordingly in AgentPress Pro. Now you want all listings for sale to be shown at http://example.com/for-sale/ and all listings for rent at http://example.com/for-rent/.
Before you proceed with implementing the following tutorial note that WordPress automatically lists entries that belong to a taxonomy term at its archive page. i.e., http://example.com/types/for-sale/ and http://example.com/types/for-rent/ work without a single customization.
If you still want the listings at /for-sale and /for-rent keep in mind that static Pages created to be at these URLs can be redirected to /types/for-sale and /types/for-rent using a plugin or redirects set via cPanel or .htaccess.
If you must absolutely have the listings appear at /for-sale and /for-rent and the redirection is not acceptable, follow along.
The Page Templates have been set to display the Page content (if present) above the listings, thanks to the code by Bill Erickson.
Step 1
Create two Pages named For Sale and For Rent.
Step 2
To view the full content, please sign up for the membership.
Already a member? Log in below or here.
Hi,
I have used the files and code provided however only one of the pages works. The For Rent doesn’t.
I was wondering if this is an usual problem?
Thanks
Hello Sridhar,
it’ s me again 😉
You work with the AgentPress Theme, so maybe you have some good ideas for my questions/problems, i asked the studiopress support but they won`t / can`t help me 🙁
(1) I`d like to have a backgound image with a smaller height (for example max-width only 400) for the homepage but i don`t now how?
(2.) I`d like to have a fullwidth navigation (like in http://my.studiopress.com/themes/winning-agent/) and a full width search listing box. It is important for me that thenavigation and also the search listing box is sticky (fixed at the top) if the user is scrolling down the page (also on mobile sites!). I`d played a little bit with your solution for a sticky first & second navigation (http://sridharkatakam.com/how-to-set-up-sticky-header-or-navigation-in-genesis/) but i`m really a studiopress rookie and can`t put this into action.
Maybe you can help me?
Thanks in advance for your time/work
Kind Regards
– Dominik
Hi Sridhar,
I have tried this and included it in a StudioPress Centric Theme and it works like a charm – love it! However, on my listings page, all my listing images are different sizes. I have tried adding the following to the Functions.php and page-my-listings.php but neither has helped:
//* Add new image sizes
add_image_size( ‘properties’, 500, 300, TRUE );
Do you have any suggestions of what might help?
Thanks in advance,
Crystal
Hi Sridhar,
Can you confirm if this code will work with AgentPress Pro Version: 3.1.3? I followed the instructions but am getting the same search results (all rent+sale) on each page, see my dev site:
http://www.pr1me.site/for-sale/
http://www.pr1me.site/for-rent/
I am not a PHP developer but noticed that we are searching for ‘types’ => ‘for-sale’ and not ‘taxonomy’ => ‘for-sale’. I did try that but the same result?
Thank you!
We need to use
tax_query
.Can you tell me the name of your custom taxonomy? Is it
types
or something else?It’s types:
// accepts any wp_query args
$args = (array(
‘post_type’ => ‘listing’,
‘types’ => ‘for-rent’,
‘paged’ => $paged,
‘posts_per_page’ => 10
));
I’ve tested the code in the latest AgentPress Pro, 3.1.3 and it works fine as is.
Anyway, I’ve updated the tutorial to improve it by using
tax_query
.Can you change the code and let me know how it went?
It’s working fine now, thank you so much!
Mike