1

I'm trying to build a scalable structure, let say I want to add different cities and have different categories so my URLs should look like this: (You can check the picture attached)

  • website.com/paris/party | website.com/paris/music | website.com/paris/lifestyle
  • website.com/london/party | website.com/london/music | website.com/london/lifestyle

So I have:

  • 1 dropdown menu for cities
  • 1 nav menu for categories such as: Party, Music or Lifestyle

If there anyone who have a Nice scalable solution for that?

Step by step explanation are better :)

I was thinking to build it this way:

  • Cities as Main Categories
  • Party, Music, Lifestyle... as subcategories for each city

However, each time I want to add a new city, it's not really good because I have to: 1)

  1. Add new Category (ex: London)
  2. Add sub-Categories for London: Party, Music, Lifestyle
  3. Create a new menu for this city (on the picture: "Popular Tags") and adding here those sub-Categories...

Any way to avoid this repeating process?

Thanks for any help!

enter image description here

1

There are various ways to achieve what you are talking about within Wordpress.

1) Multisite/Network. For each City (or whatever your top level is), you create a new site with a default theme. This allows for either www.website.com/paris/music or paris.website.com/music, depending on your requirements.

Introductory info on Network sites

Creating a Wordpress Network

2) Write Plugin to automate item creation You could wrap the category creation and subcategory assignment on a single site, as well as menu creation, into a plugin. From plugin admin you enter new top level categories, and have it do the rest.

Plugin Development Handbook

A combination of 1 and 2 above is possible as well.

You also approach it with hierarchical Custom Post Types and custom taxonomies.

Taxonomies in Wordpress

Custom Post Types

In either case, theme templates solve the front end display.

Study the Theme Developer Handbook for possibilities.

  • Hey thanks for your answer. So if I'm using multisite structure, I will pay the hosting for each subfolders (cities) that I will create right? About the Custom Post Types, You suggest to create 1 Custom Post Type for Each City and add inside Each Custom Taxonomies (which here will be the same for every city)? – majningmaster May 12 '17 at 22:13
  • As far as hosting a multisite/network, it is run from a single wordpress core install. You do need some extra things, like dedicated ip and ability to setup wildcard dns if you're going to do subdomains. I do not recommend a shared hosting plan for it. On the other... – hwl May 12 '17 at 22:23
  • All right, so I'm creating let's say a Network/Multisite and installing WP on "website.com", then I create "website.com/paris" and "website.com/london" as a subfolders and host them. So in this Case I Will pay more for the hosting than using a SingleSite? Could you clarify me also If I'm right concerning Custom Post Types? Thanks again. – majningmaster May 12 '17 at 22:30
  • Taxonomies can be shared across post types. So you can have a music Taxonomy and assign it to the Paris CPT and to the Berlin CPT. Or have a cities CPT with entries of Paris, Berlin, etc., and a music CPT and tie them together relationally through a shared taxonomy (say City Name with values of each CPT post. On the last one, a city post named Berlin and a Music post about Berlin could both have Berlin taxonomy. The organizational structure depends on what you wish to achieve. – hwl May 12 '17 at 22:30
  • You create Network install on Website.com. You choose subdirectory install. From within WP Network Admin, you create a new site named "Paris". This will exist at Website.com/Paris. It will add a site_id layer to the database. All manageable through one install, and possible to have separate admins for each, with a Super Admin user over the Network. – hwl May 12 '17 at 22:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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