Sauter la navigation

[Résolu] Create 1 template for category archive with WPBAKERY

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem: I would like to create 1 template and add it to all of my categories...but after the website will be managed by someone who doesn't know a lot about code and I want to give him the possibility to change some elements.

Solution:
I assume you are talking about category archive pages, like yoursite.com/category/uncategorized. If you want to use the same WPBakery template for all these category term archives, no special PHP template file is required. Go to Toolset > WordPress Archives and create a new WordPress Archive. Assign this archive to the "Category" taxonomy (see new-wp-archive.png).

Scroll down to the Loop output editor of this WordPress Archive and click the "Skip wizard" link. Place your cursor inside the wpv-loop tags and click "Content Template". Create a new Content Template and assign it to this archive (see new-ct-for-archive.png). Then scroll down to the Template Editor and you will be able to design this template with WPBakery, and you can allow your site admins to edit that template later with WPBakery (see edit-ct-with-wpbakery.png).

You should only use the hook wpv_filter_force_wordpress_archive if you want to use a template that is different from the one you assigned to the Category taxonomy (see new-wp-archive.png). Like for example, if you want to one WPBakery template created above for all terms in the Category taxonomy except "uncategorized", then you will create another WordPress Archive that is not assigned to any taxonomy or post type, and design its loop template with WPBakery like before. Then use the wpv_filter_force_wordpress_archive hook to show this new WordPress Archive if the current archive is "uncategorized".

Relevant Documentation:

This support ticket is created Il y a 6 années et 8 mois. 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Ce sujet contient 2 réponses, a 2 voix.

Dernière mise à jour par martyB Il y a 6 années et 8 mois.

Assisté par: Christian Cox.

Auteur
Publications
#644308

Hi all!

I have looked to try to find the answer but just found some information but not really what I'm looked for, so I ask you =)

Firstly, I would like to create 1 template and add it to all of my categories. But is it possible to do it only by WPBakery? because I can do it by code but after the website will be managed by someone who doesn't know a lot about code and I want to give him the possibility to change some elements.

Secondly, How I can attribute my template to the category taxonomy? Do I have to use the hook "wpv_filter_force_wordpress_archive" ?

Many thanks

#644908
new-wp-archive.png
new-ct-for-archive.png
edit-ct-with-wpbakery.png

Firstly, I would like to create 1 template and add it to all of my categories...but after the website will be managed by someone who doesn't know a lot about code and I want to give him the possibility to change some elements.
I assume you are talking about category archive pages, like yoursite.com/category/uncategorized. If you want to use the same WPBakery template for all these category term archives, no special PHP template file is required. Go to Toolset > WordPress Archives and create a new WordPress Archive. Assign this archive to the "Category" taxonomy (see new-wp-archive.png).

Scroll down to the Loop output editor of this WordPress Archive and click the "Skip wizard" link. Place your cursor inside the wpv-loop tags and click "Content Template". Create a new Content Template and assign it to this archive (see new-ct-for-archive.png). Then scroll down to the Template Editor and you will be able to design this template with WPBakery, and you can allow your site admins to edit that template later with WPBakery (see edit-ct-with-wpbakery.png).

Secondly, How I can attribute my template to the category taxonomy? Do I have to use the hook "wpv_filter_force_wordpress_archive" ?
You should only use the hook wpv_filter_force_wordpress_archive if you want to use a template that is different from the one you assigned to the Category taxonomy (see new-wp-archive.png). Like for example, if you want to one WPBakery template created above for all terms in the Category taxonomy except "uncategorized", then you will create another WordPress Archive that is not assigned to any taxonomy or post type, and design its loop template with WPBakery like before. Then use the wpv_filter_force_wordpress_archive hook to show this new WordPress Archive if the current archive is "uncategorized".

#648508

Really cool, thanks for this full answer =)