Customizing the Taxonomy Page

I am new to CustomPress where this is my first time using it. I am currently building a test development version here:

I am creating a database for store locations.
Custom Post type is locations.
Taxonomy is city, with the following: Phoenix, Tucson, Bullhead City, Portland.

Each location will be within one of these cities.

I am using the single-locations.php template that CP created for me to edit the individual location page. How would I edit the taxonomy page to display only a list of those posts assigned to that taxonomy? Ex:

When clicking on "Phoenix" from the page above, it would take you to this page:

This is the basic archive template that comes with this theme. Is there a way I can create a duplicate of this and call only "Phoenix" posts so I can customize it more? I'd like to include a custom Google Map etc. I'd like to do this for all of the other cities. I am redeveloping this site using custom posts rather than raw HTML, and would like a location structure like this:

I hope all of this make sense? Let me know if I should clarify anything.

  • itrogers
    • New Recruit


    Yes, the taxonomy link automatically is created for me as well. The issue is that I need to edit that page of the archives. I have created the archive-locations.php file but it is still displaying the dynamic content in archive.php. Am I missing something? Thx all for your help.

  • Timothy Bowers
    • Chief Pigeon

    Hey again.

    It should take the post type for the file name: archive-{posttype}.php

    So if locations is the actual post type, then it should be archive-locations.php

    Of course you could still use the archive.php file and then run a PHP case or conditional with something like shown on their page:

    $args = array( 'post_type' => 'product', 'posts_per_page' => 10 );
    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post();
    	echo '<div class="entry-content">';
    	echo '</div>';

    Obviously changing:

    'post_type' => 'locations'

    Then it will pull the locations for that loop.

    Take care.

  • simon_kelly
    • New Recruit

    Hey itrogers, for the taxonomies part of your question I'm working on something similar for a site and did the following:

    - set permalinks to /%category%/%postname%/
    - create a file called taxonomy-cities.php

    Because this follows the correct template hierarchy you don't have to do a custom query within the loop on this page, just use a default loop to get it working then customise from there.

    Hope that helps!

    With the permalinks part of your question i'm not 100% on the best way you can achieve this. I'm doing a simpler version of the way you've described your system where I just have /locations/location. I am actually wanting to customise them to be locations/state/locations so if I manage to get this done I'll post back otherwise I'll settle with locations/location

  • Kimberly
    • Champion of Loops


    Just checking in :slight_smile:

    I'm guessing that because we haven't heard back from you that you've got your issue worked out or that we have reached the end of our convo here. If you are still having problems or need any other answers on this particular topic please feel free to come back to this thread at anytime. Just be sure to mark it Not Resolved so we don't miss it!

    This ticket is only being Resolved due to lack of activity. It is by no means an action to avoid, brush off or minimize your issue. We are ready and here if you want to re-open at any time and I apologize in advance for any lack of communication if this ticket is being closed in error.

    Thanks for being part of the WPMU DEV Community!


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.