Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a scenario in which the intention is to make custom permalink that can be changed dynamically, for example:

  • If a country information is showing up then the URL should be http://example.com/country-information

  • If the city information of that specific country is showing up then the URL should be like http://example.com/country/city-information.

How can I achieve that?

share|improve this question
    
Are cities and countries custom post types? –  toscho Apr 6 '13 at 8:19
    
Yeah! They were meant to be custom post types but i had managed to do in another way by doing some URL rewriting. –  Adil Sep 21 '13 at 7:27
    
Please add your solution as an answer, so other readers can learn something. –  toscho Sep 21 '13 at 8:50

1 Answer 1

It depends on what you mean by "changed dynamically", but the simplest way to achieve what you're talking about is to use pages (or a hierarchical custom post type), and make the "city-information" pages into children of the "country-information" page they are associated with. Then set permalinks to "Post Name", and you'll get the urls you're looking for.

share|improve this answer
    
By involving some jQuery to avoid "page refresh" every time. Sorry! I was away but I was able to achieve that back then with URL Rewriting, and got that hierarchical order you have said! Thanks for the help btw :) –  Adil Sep 21 '13 at 7:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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