Site logo

[Resolved] Custom Taxonomy Archive

Home Forums Support [Resolved] Custom Taxonomy Archive

Home Forums Support Custom Taxonomy Archive

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #968160
    Raul

    Hi,
    I am testing a custom taxonomy (art_series) that is linked to WooCommerce Products. The taxonomy uses ACF to include a single field (series_years) and an image (series_image).

    Is there an easy way of creating a template to display terms in this taxonomy including each image and single fields? Should I start from the archive.php template of is there a taxonomy template? What should be the right permalink to access this template?

    I first tried creating a new page with an element to display all terms in the custom taxonomy, but I am not sure if I can use this method to display the ACF fields as well.

    Any help would be much appreciated!

    #968220
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    The archive.php file is definitely the one to build from. This might help: https://developer.wordpress.org/themes/template-files-section/taxonomy-templates/

    As for the permalink, you should be able to find out by looking into the terms and clicking “View” on one of them – that should show you the general permalink you’ll be using.

    Let me know if you need more info 🙂

    #968489
    Raul

    Thanks for your quick reply.

    What I need is to show in a grid all taxonomy terms with an image and year. The images are defined with ACF image field and the year is a ACF simple text.

    I have listed all terms of my custom taxonomies here:
    http://35.232.201.230/~suzanne2/test/art-projects-by-suzanne-anker/

    And have created 2 copies of the archive.php and renamed as: taxonomy-classification.php and taxonomy-art_series.php, based on the slugs of custom taxonomies. Didn’t modify any code from the original yet.

    Then two problems arise:

    1. If the taxonomy archive template exists, the product thumbnails are not shown when looking at each taxonomy term page. See here: https://www.dropbox.com/sh/nfyse837d23nej4/AAB8zn2VJ-gYOI5_oYqx0Quja?dl=0
    2. I don’t know how to display a general taxonomy archive. For example, in art_series taxonomy I want to show the main taxonomy terms in a grid with an ACF image field for each one, similarly to the way single products are shown here http://35.232.201.230/~suzanne2/test/product-category/artworks/

    I found this about WP and taxonomy archives: https://wordpress.stackexchange.com/questions/48435/get-term-archive-url-link

    Not sure what I am doing wrong, perhaps the URL might be the problem.

    Any suggestion?

    #968930
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    This really depends on the code in your templates. Are you adding the necessary code to display a featured image for example?

    This kind of stuff is hard to support in the forum, unfortunately, as it’s not directly related to GP.

    For the URL, it should be something like this:

    https://yoursite.co/your-taxonomy-slug/your-term-name/

    #969085
    Raul

    Thanks Tom,

    Yes, I understand this is not GP related. Will try to solve it without creating a taxonomy.php template.

    The URL you suggest works by default using the archive.php because is for a specific taxonomy term, but what I want to show is the full archive of terms from that taxonomy.

    #969175
    Tom
    Lead Developer
    Lead Developer

    Something like that will likely require a custom page template (https://developer.wordpress.org/themes/template-files-section/page-template-files/) with a custom loop to output the terms.

    That way you would create a static page (so you’d have an easy URL), and the page would output your list.

    #973353
    Raul

    Thanks Tom,

    For anyone else with the same question, finally I decided to use child product categories instead of a custom taxonomy. All my artwork products are now categorized with an “artwork series” name, and used a shortcut [product_categories number="999" parent="16"]to display all series directly via the archive.php. Therefore I don’t need to create a custom taxonomy template (I tried multiple options and didn’t behave the way I wanted)

    #973489
    Tom
    Lead Developer
    Lead Developer

    Glad you got something working 🙂

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.