[Resuelto] Product category name not appearing in the archive category product page
This support ticket is created hace 6 años, 7 meses. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.
I have a site with Toolset + WC and have created product categories.
I have created additional info (termmeta) for the product categories (description, images ...)
I have also created a Layout to display all info about the category.
The product category is displayed in this kind of page : enlace oculto (here, the product category "Sculpture) is used)
When a product is linked to the category, everything is displayed (standard field like catagory name and specific fields as images).
But when no product is linked to this category, only specific fields are displayed and the category name is no more available.
Is there something special to take into account for this type of page?
We have to cheat a little to be able to display the term custom fields on the taxonomy archive pages, but it seems we don't consistently do the same for the standard fields.
With archive pages the global $post object is missing, and so we use the first post in the archive as a fake global $post object to retrieve fields from.
If the archive is empty and there is no first post, there is nothing to retrieve the fields from.
In my testing—consistent with your experience—we get this working for Types term meta fields, but not for standard taxonomy fields inserted with Views shortcodes.
wpv-post-taxonomy doesn't work because there is no first post, and the shortcodes such as wpv-taxonomy-title don't work because the context is wrong (they are for use in taxonomy Views, i.e. Views which query a taxonomy and return its terms).
You could add a taxonomy View that had a filter for the term from the current taxonomy archive page to provide the correct context for the wpv-taxonomy-title etc. fields, but there is no such filter.
So, in sum, it doesn't look possible to output the standard taxonomy fields on an taxonomy archive page (except in the Loop Output section itself, where you would output them for every matching post). The only shortcode that works in this context is wpv-archive-title, but it takes no parameters and so you cannot format the output.
Let me consult with my colleagues about this.
Although it seems fairly straight-forward I think this will fall into the category of feature request.
In fact, I think the best way to manage this for me right now is to add a term meta that should represent the name of the taxonomy.
With this, everything works fine and I have no more to deal with difference between term meta and standard fields of taxonomy.
Of course, for the future, that would be good to have the same "way of doing" for both is possible as we need to mix standard and term meta in the same page (otherwise, I see no advantages to use term meta !!!).
This was discussed internally and it was agreed to treat this as a feature request, and such a ticket for the request has been created. Of course, I don't have any forecast for when this would be implemented at the moment.