Archive pages are broken

Description:

I just realized that at least since version 1.2.9.9.5 my archive pages are broken.
For my archive pages I use the default template option like this: Themer > Templates > + Default > and then I select the archive for my CPT.
Also I have a general archive page that is used when there is no specific archive available.
For some reason when I view the archive in the frontend Cwicly is no longer using the archive that I created for the CPT rather than the fall back template.

Bildschirmfoto 2023-09-19 um 11.24.14
(this “Template: Archive” is the fallback template. It should say “Template: CPT”)

On top of this the fallback template does not get rendered correctly resulting in a completely destroyed page.

When I create a custom template and target the archive of my CPT however it works as it should.

I tried this on three different installations and had the same result everywhere.

Step-by-step reproduction instructions:

  1. Create a CPT with an archive
  2. create an archive template for your CPT like this: Themer > Templates > + Default > your CPT
  3. create a default fallback template for all archives
  4. now visit your CPT archive and check what template is being used

It seems this only happens for archives that are created before the fallback template.
So if I would have created the fallback archive first everything would work fine.

Hi @Jonas,

how do you access your archive/ set your conditioning for an archive?

I just tried to create a template and connect it to my archive but was not able to with the Archive condition below.

grafik

Cheers

Hi @T-low,

I did not select any conditions since I used the default template option. this works without using conditions.

So it appears that it works as soon as I also select a condition. I’ve never done this and somehow didn’t even try this :man_facepalming:

But until a few versions ago it worked this way so there was no need for custom visibility conditions.

Anyway, thanks for pointing this out! This takes the urgency away from this one :ok_hand:

1 Like

Now that I think about it it also could be that this happened because of a WordPress update. That’s actually most certainly the cause of this issue. So I’ll just use the conditions from now on.

Sorry for the drama :smiley:

Glad you found a solution to your problem :+1:

But can you actually connect a template to an archive? My comment was meant as a confirmation to your bug… So I’d be really interested to know how you made your connection, since mine isn’t working. :sweat_smile:

Did you create a custom template or a default template?

Your conditions target all archives. For my template that is meant for all archives (where I did not create a specific template for) I still don’t use any visibility conditions. I just create a default template:

Themer > Templates > + Default > All Archives

Now when I have a CPT archive where I don’t wont the standard template I again go to:

Themer > Templates > + Default > CPT Archive

and create the template.
What’s new now is that I also need to select the following visibility condition:

This way the CPT Archive is only used on the CPT archive while the fallback archive is used everywhere else.

I was just testing to see if I could even see my template on an archive page.
I have never used the default templates :sweat_smile:
As far as I know, the only difference between default templates and custom templates is that the visibility conditions are preset.

So if I create a custom template that has the Show if -> Archive -> All condition, I expect it to show up in all my archives… :thinking:

This is not the case for me.

I use the CPTs from ACF :thinking:

I believe the default templates are the ones that come with the theme or WordPress. When you create a custom one you just overwrite the default template. When you create a default template it will alter the default template that comes with the theme.

It should show up. Are there any other templates that are assigned to some of your archives?

I also use CPT with ACF

1 Like

I have turned off the visibilety conditions of my other templates, so there should be no interference?
Well, I will test this later during a clean install :thinking:

will report back :+1:

Since you use custom templates I don’t think there can be any interference. I mean a custom template without any conditions is not shown anywhere.

Please do so! Would be interested to know what the issue was.

So here is my brand new local installation where I created an ACF CPT and filled it with 5 posts.

Then creating a custom template for that archive

grafik

Adding my awesome design to that template:

Setting the condition to all to check if the design is displaying correctly:

grafik

Which is working:

grafik

Setting the conditions of the template to show on all archives:

grafik

Which leaves my page empty:

By creating a default template for all archives:

grafik

Creating another awesome design for the teplate:

grafik

And the result is, that it is not displaying on my page:

Any ideas for a fix? Is there an error somewhere? Or is this a real bug?

Cheers

Did you turn on the archive?

1 Like

Of course not… why would I turn on the archive? :sob:

Thank you @Jonas, that did the trick :+1:

Forgot with time that these two are not the same :grimacing:

1 Like

Yep, some times the solution is very obviously hidden :ok_hand: :laughing:

Happy to hear everything is working now.

1 Like