Skip Navigation

[Resolved] Problem creating a custom WooCommerce taxonomy template

This support ticket is created 4 years, 1 month ago. 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 4 replies, has 2 voices.

Last updated by laurentL-2 4 years ago.

Assisted by: Waqar.

Author
Posts
#2096911
Modifier-le-bloc-d-archives-WordPress.png
Campings-–-template-toolset-taxonmy.png

- Tell us what you are trying to do?
I think the model editor is not working as it should.
I want to customize a page template for a WooCommerce taxonomy, but only the loop is changed. All the other elements are added in this loop and are not shown on the outside, on the rest of the page as they should be (see image of the editor)
The title of the template is the title of the first element of the loop instead of the title of the taxonomy, etc. (see images).

This template should display for example the title of the current taxonomy, its description, and other information thanks to the ACF custom fields (with the Toolset blocks); then display the WooCommerce products loop (View).

I have the latest version of the plugins, and I tried to deactivate them to see if the problem was corrected, but it is not the case.
The theme used is GeneratePress.

Currently I can't modify anything with Toolset concerning the archive pages.

- Is there any documentation that you are following?
I can't find my problem on anything I've seen on the forum.
I thought I could add blocks outside the WordPress archive before?

- Is there a similar example that we can see?
A bit like this presentation (see this address for this site): /jeux-stands-danimation/
(image, taxonomy title, children's categories, then the product loop)

- What is the link to your site?
/profils/campings/

#2097673

Hi,

Thank you for contacting us and I'd be happy to assist.

Your observation is correct and there is no built-in feature available to show the current taxonomy term's details on the taxonomy archive created using the the blocks editor.

To show the current term's information in this case, you can use a custom shortcode:


add_shortcode('get_current_taxonomy_info', 'get_current_taxonomy_info_func');
function get_current_taxonomy_info_func( $atts ) {

	$return = $atts['get'];
	$term = get_queried_object ();
	return $term->$return;

}

The above code snippet can be included through either Toolset's custom code feature ( ref: https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/ ) or through the active theme's "functions.php" file.

Next, you can add a "Fields and Text" bock on top of your WordPress Archive loop, and include this shortcode to get different elements from the current term, like this:


term_id: [get_current_taxonomy_info get=term_id]

name: [get_current_taxonomy_info get=name]

slug: [get_current_taxonomy_info get=slug]

description: [get_current_taxonomy_info get=description]

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#2098113
ordre-blocs-tax-toolset.jpg
toolset-loop-archives.png

Hello and thank you for your answer.

I will do this for my archive pages.

However, why can't I get out of the WooCommerce product loop, when my Gutenberg block is well outside?
It's like a mise en abyme and my content is still in the products area (loop).

Is this the normal behavior or a bug on my side?

#2099281

Thanks for writing back.

This is an expected limitation since on the archive pages there is no global single post object available, like on a normal single post/page.

That is why even if the block is placed outside the archive page's loop it uses the first item available from the loop, as a source.

#2099305

Okay, it's just that Toolset doesn't fully support these kinds of archive pages to manage all of their content. It basically handles the layouts of single posts/pages.

Thanks for the support.