How display certain categories based on what Custom Post Type page you are on... (1 post)

  1. Jack Barham
    Posted 5 years ago #

    I have created Custom Page Types for fitness classes and the client will be able to add in a new page/class as they require it.

    Each class will have certain variables which can be selected as categories to display other related products and cities where these classes take place.

    All of the classes will use the single-classes.php Custom Post Type template but as each of the classes are slightly different will need to show different results of categories listed.

    An example would be: a Spinning class has been added and I tick each city that is it available in (which I have created as child categories). If it was a standard template page I would write some code to only display the cities that class is available in on the sidebar.

    However, the problem I have is that the page is dynamic so they may add Body Pump, Yoga, Pilates, etc and each class is only available in certain cities.

    So the question is what the code I would need to add to single-classes.php so it dynamically generates the list of cities (which I have listed as child categories) available depending on what class is displayed.

    I hope that makes sense and look forward to any responses.


Topic Closed

This topic has been closed to new replies.

About this Topic