Lorenzo Banci
Lorenzo Banci

Reputation: 37

Wordpress custom Breadcrumbs (Multiple taxonomies)

I'm facing a wall at the moment. I've been trying to solve this one for a while now but I've had no luck. I'll try to explain as best I can since English is not my main language.

I'm working with a company that often builds Real Estate websites in Wordpress. They often use a Wordpress theme for real estate websites by the name of Houzez. The theme they are using doesn't come with this feature out of the box (Already asked support)

I'll try to explain with an example:

I have a custom post called Properties and 2 taxonomies, Type and City (Actually there are more taxonomies but let's keep it at 2).

As an example take the following terms: Apartment, Berlin. I would like to build my own breadcrumbs structure. How can I make the taxonomy "Type" interact with the "City" taxonomy and have a structure like this:

Home > Properties > Apartment > Berlin > single post title.

At this point if I'm on the single post page and I click on Berlin I would like to keep the hierarchy intact and browse all the Berlin Apartments, but not all Berlin properties.

What is a good way to make 2(or more) taxonomies work together like this?

The theme's built-in breadcrumbs take into account only the "Type" tax to build the structure, and so does every plugin I've tried. Taxonomies are not meant to work this way, I know, but the company I'm working for doesn't really care that much.

So I think I need to custom code this, but my limited experience (3 Years into WP, PHP and coding in general) is making this one of the hardest tasks for me.

To work around this I've tried to fake the "Type" terms using the city as children of "Type" terms, like so:

But at this point any other type should be built in this way having multiple "Berlin" terms for every different type - this is not going to work. I feel kinda lost and tempted to tell them this is not possible. At the same time, I feel like this could teach me a lot.

Hope you can help me or at least point me in the right direction.

Thank you so much.

Upvotes: 1

Views: 761

Answers (1)

Tammy Shipps
Tammy Shipps

Reputation: 945

You might be able to solve this by creating a custom taxonomy structure, or by overriding the one you're already using. You can then tell WordPress what exact permalink / url structure and hierarchy you wish to use, separately from the vanilla taxonomies.

If you don't know how to make your own taxonomies for WordPress, you can use the Taxonomy tool at GenerateWP to get you started. The section you want to look for us under Permalinks:

enter image description here

And here's an article about the URL structure you get by default, so you know better how you might want to change it.

Upvotes: 1

Related Questions