- This topic has 7 replies, 2 voices, and was last updated 6 years, 1 month ago by
Tom.
-
AuthorPosts
-
July 26, 2019 at 2:21 pm #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!
July 26, 2019 at 5:27 pm #968220Tom
Lead DeveloperLead DeveloperHi 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 🙂
July 27, 2019 at 6:18 am #968489Raul
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
andtaxonomy-art_series.php
, based on the slugs of custom taxonomies. Didn’t modify any code from the original yet.Then two problems arise:
- 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
- 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?
July 27, 2019 at 7:32 pm #968930Tom
Lead DeveloperLead DeveloperHi 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/
July 28, 2019 at 4:49 am #969085Raul
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.July 28, 2019 at 6:58 am #969175Tom
Lead DeveloperLead DeveloperSomething 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.
August 1, 2019 at 12:40 pm #973353Raul
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 thearchive.php
. Therefore I don’t need to create a custom taxonomy template (I tried multiple options and didn’t behave the way I wanted)August 1, 2019 at 4:26 pm #973489Tom
Lead DeveloperLead DeveloperGlad you got something working 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.