• Resolved brutex

    (@brutex)


    Hi!

    I’m building a bike site that has multiple bike brands and I’m using tags for the brand names. So for example there are tags like “trek” , “raleigh” and “scott”

    Then I have categories for bike types like “mountain bikes”, “road bikes” and “city bikes”

    So I can list bikes by brand or by type and it works without problems. The problem comes when I am in the tag archive page and I want to filter the posts by category in the tag archive by showing buttons/dropdown with all categories that have posts with the current tag.

    So let’s say there are ten mountain bikes and five road bikes from brand Trek but no city bikes, so I want to hide the city bike category link as long as there are no bikes by Trek in that category.

    Any ideas how could I do that? I can only find solutions that work for a single post but nothing for all post listed in the archive page.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello,

    You can add the tag as a parameter to the category to filter it. This should work out the box with no additional plugin:

    /city-bikes/?tag="raleigh"

    If you want to get rid of the actual name ‘tag’ on the URL you should set up a new taxonomy called ‘brand’ or similar, then the URLs would look a little nicer like:

    /city-bikes/?brand="raleigh"

    Hope that helps!

    ~ Steven

    Thread Starter brutex

    (@brutex)

    Hello!

    Thanks for the reply! Yeah that is true and it works great and i can do links for all of the categories like that but the problem is that I want to hide the categories that has not got any bikes from that brand.

    Like if Raleigh has bikes in city and road bikes I would like to show only those links and not “mountain bike” link because there are no mountain bikes from Raleigh

    Sure I can do that manually and add only those that has bikes in them but it is going to be a big project if I have like 100+ brands.

    Thread Starter brutex

    (@brutex)

    I got the solution at last ??

    This was the answer

    Thread Starter brutex

    (@brutex)

    Resloved

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Get all categories that are associated with tag archive’ is closed to new replies.