Skip Navigation

[Resolved] Cannot apply content templates to archives

This thread is resolved. Here is a description of the problem and solution.

Problem:
The user is trying to assign a content template to an archive, but the content template seems to not be used on the archive.

Solution:
When you assign a content template to an archive, the content template will not be used to display the results of the archive. Instead, it will be used to display each result of the archive.

The content template is meant to display a single post. When assigned to an archive, it will be used for each post in the archive results.

When the user uses a dedicated WordPress Archive, the assigned content template will not be used.

Relevant Documentation:
https://toolset.com/glossary/

This support ticket is created 4 years, 7 months 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: Africa/Casablanca (GMT+01:00)

This topic contains 11 replies, has 2 voices.

Last updated by peterJ-3 4 years, 6 months ago.

Assisted by: Jamal.

Author
Posts
#1614589

I am upgrading a site from Layouts to Blocks. Previously I used wordpress archives with layouts. I now wish to manage my archives with content templates.

However, when I disconnect layouts (and deactivate the plugin), unassign the wordpress archive and then create and assign a content template for the archive, the archive page returns a 404 error. I have been looking through all of the settings and can't find any obvious way to resolve this.

This is on a staging site, which I can give you access to. You will need htpassword access, too.

#1615095

Hello and thank you for contacting the Toolset support.

I would like to login to your staging site and check this issue. Your next reply will be private to let you share credentials safely.

Please provide as many details as possible:
- What archive?
- What content template?
- What URL on the frontend?

#1616621

Hi Peter,

The HTPASSWORD is working for me but the WordPress credentials are not, can you double-check it from your end and update the credentials on your previous or new message.

#1616957

Apologies. You can log in now with the same credentials shared above. My mistake.

#1617161

Sorry, but the credentials are still not working. Can you give it another try and share the credentials in your next reply.

#1618049

So sorry. It is definitely working, now.

#1618053

Thank you. Indeed, now the access are working.

I logged into your website and checked a bit the content templates and the WordPress Archives templates used for archives. Then I visited some archives pages on the frontend without issues:
- hidden link
- hidden link
- hidden link
- hidden link

Can you provide more details on the issue?
- Which archive page does return 404? What URL?
- What content template would you want to assign to an archive? And what archive?

#1618073
#1618155

My apologies, I totally missed it. But now that I logged in, I can see the issue more clearly.

First, please check our glossary to read more about the differences in content templates and archive templates.
- https://toolset.com/glossary/

Content templates are meant to display a single post. Archives display all posts that have something in common, author, taxonomy, post type, etc.

When Toolset has an archive template assigned to a kind of archives, it will be used for rendering the archive.

When there are no archive templates assigned, the default theme archive template(from a WordPress perspective) will be used. In this case, Toolset can use an assigned content template for the archive items to replace the_content() call in the theme archive template.

Check this screenshot hidden link Here we are using a Toolset Archive template(Archive: Race series). Notice that the content template(Content template for Race series). Because of the archive template "Archive: Race series" takes care of rendering the whole archive page. We may use the content template "Content template for Race series" or another content template inside the archive loop.

Check this screenshot hidden link Here we are not using the Toolset Archive template. The theme template is used, and Toolset replaces the_content() call with the result of the assigned Toolset Content Template for the archives of taxonomy "Race Series".

I hope this answers your questions. Let me know if you have any doubts.

#1618211

So to be clear... am I correct in understanding that content templates applied to archives are applied to the loop within the archive, rather than the archive template itself?

It is not possible to replace a loop on an archive template? We can only set it to display zero results and then build the rest of the page around it with blocks.

I essentially want to use archive pages more as landing pages than simple list pages and so want to build them up with various blocks and views representative of multiple child content types and relationships.

#1618245

So to be clear... am I correct in understanding that content templates applied to archives are applied to the loop within the archive, rather than the archive template itself?
Yes. You are right.

It is not possible to replace a loop on an archive template? We can only set it to display zero results and then build the rest of the page around it with blocks.
You can customize what will be displayed inside the loop. When you first create an archive template, the loop is empty and you can add blocks inside of it. You can add any blocks, including View block and Content Template block.

I essentially want to use archive pages more as landing pages than simple list pages and so want to build them up with various blocks and views representative of multiple child content types and relationships.
You can't without very complex custom code.
Every page you visit in a WordPress, WordPress creates a global query that will determine what to display(rewrite rules are used in the process). WordPress then determines if the requested URL is the homepage, a regular page, a post, the blog page(which is the default archive page for posts), a category page(which is an archive page), etc.
Archive pages are also the result of a global query based on the archive parameters(post_type, taxonomy, author, date, etc.)

Toolset Views are built around the same concept of a query and a loop. Content templates are meant to display a single post(or custom post). Maybe you need to mix views and content templates for your landing pages' needs.
If you elaborate more on what you try to achieve, I might give accurate advice.

#1618253

OK. I think when I saw content templates, I got a bit hopeful.

Moving from Layouts, I was hoping I would be able to apply a content template to an archive in the same way that I would have previously been able to apply a layout to an archive.

With the Layouts route, the layout for the archive did not necessarily use an archive loop. It was possible to build the page as you want.

With WordPress Archives and Blocks, this is much more limited, and there is no way to remove the archive loop from the archive output. So, for now, I will go forward nesting views in the archive container with the archive loop set to return zero results.

Perhaps this is something the development team are looking at, or might want to look at.

------------------------
"You can't without very complex custom code."

This is not true at all. It can be done easily without writing any code, just using Toolset standard features. There are many examples of such on the site you have been looking at.

However, I was hoping to be able to edit the output of an archive with a content template interface without the archive loop forced into the interface. The toolset panel for adding content templates for archives in the admin teased me into believing I could acheive this.

Just a case of elevated expectation.

Thanks for your help.