0

Please give me a suggestion this situation of mine. I have a custom post type "house". It comes with 2 custom taxonomies: "region" and "status".

I would like to get out all the "house" which are "for rent" and are located in "istanbul" of "turkey"when I type this URL to the browser:

hostname.com/for-rent/turkey/istanbul

Thanks

2
  • Do you already have the page ready to display the posts? May 12, 2016 at 15:45
  • Yes I do. I want to detect the URL segment to modify the query now.
    – Trang
    May 12, 2016 at 15:49

1 Answer 1

0

You can use a rewrite rule in your htaccess:

/for-rent/turkey/istanbul

RewriteRule ^for-rent/([^/]*)/([^/]*)$ yourpage.php?country=$1&city=$2 [L]

Than in your yourpage.php:

$country = $_REQUEST['country'];
$city = $_REQUEST['city'];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.