skip to Main Content

How to make WordPress create a query based on a slug ? For example I have my wordpress site url as http://example.com/.

I want to generate a page based on the slug provided on the url. This is a realty wordpress directory site. So I will just append the city/state name on the slug. Instead of creating a lot of pages how would I implement this way

http://example.com/texas

It will show all real estate agent members in texas. Then I could write my meta desc and other seo related metas to texas dynamically

2

Answers


  1. You can base this on tags. Of course if your template supports tags taxonomy. For every single entry you need to add tag (Texas, Kentucky etc.)

    Login or Signup to reply.
  2. Simple use something like that

       <?php  $the_query = new WP_Query('pagename=here_your_page_slug'); ?>
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search