Templating in Cwicly kinda hurts

So I have been trying to create a basic Main template containing Header / Main / Footer sections.

There are bunch of questions that arised for me even though I am not a total beginner.

  • Should I create a template part for header / footer?

  • Or should I create a new fragment and apply a template part there?

  • What is the difference between setting conditions inside fragments modal and inside a template part itself?

Besides that, the whole process of creating a templates and template parts was really a painful one.

After creating a new template part, that template part wasn’t displayed in Template parts. After countless reloading it finally appeared, with a bunch of other templates I deleted. Then they started to miss again.

On the front end, sometimes it was fetching the header template part, sometimes not. Other times, it was fetching a header template part I previously deleted.

I think there is a lot that can be done to streamline the template creation process. With a background of UI/UX designer, I’d be glad to help.

Everything could be so much easier…

Might be a good idea to reach out to WordPress/Gutenberg if you are really experiencing these bugs since they are the instigators of FSE.

Up to you really? Directly inside the template or with a template part or a fragment, it’s your workflow. Isn’t that how it works for every other builder?

Is this when you’ve applied conditions or not? This is the first time I’ve heard of such an issue so definitely something to look into since it sounds like something might be badly set up on your side.

Hey @Louis,

thanks for a response.

Please watch this video, where I explain it: AwesomeScreenshot-5/28/2022,12:57:08PM

In your video, you didn’t open the Index template.

But, more pertinently, you have to specify which template is applied to a post/page. Per WP spec, the fallback template for all posts, unless otherwise specified or available, is index.php (or index.html in FSE). WP checks through a hierarchy of templates, looking for a match.
Link here: Template Hierarchy | Theme Developer Handbook | WordPress Developer Resources

Even after you deleted the Main Template, it was still displaying header and footer, so it’s clear this is being pulled from the index template. This is expected behaviour from WP.

I won’t discount that there is something else happening. Could you show us a screenshot of the structure of your index template? Also, could you show which template you have applied to the sample post?

I didn’t apply header & footer to Index template nor did I change it in any way so I doubt this has got something to do with it honestly.

Index template was containing only a “post content” element. Nothing more, I didn’t change that at all.

As shown in the video, the home page was inheriting Main template, which is right, because in the “Main template” condition I applied it to the every page / post.

@Louis any thoughts on this?

Hi @Dev.tomi,

Sorry for the late reply, was taking a few days off but right back to work.
Thanks for the video, really clear and precise.
Indeed, there definitely is an issue here.

Might I ask, have you by any chance had the Gutenberg plugin active at some point? I did experience the problem with missing template parts at some random time, and it seemed to be related with the Gutenberg plugin.

Also, would it be possible for me to temporarily log in to your installation to see what’s going wrong? Would really be helpful.

Thanks again for taking the time for the videos and details.

Thank you @Louis , I sent you a message with a temporary login link for one week.

Hi @Dev.tomi,

Thank you very much for the access. I was able to reproduce the issue constantly thanks to your example.

It should be fixed on your installation and we’ll be releasing an update today with the necessary fixes.

Thanks for your persistence :wink:

I am glad it helped @Louis ! What was the issue, if I may ask?

In quite a few instances the conditions for the Global Headers and Footers wouldn’t be updated correctly. Resulting in the conditions keeping removed fragments which explains why you were having the header and footer template parts appear.

As for the template parts not being listed in the Site Editor → Template Parts section, Gutenberg was somehow applying the conditions from our theming to the Template Parts… Interesting to know that the WordPress team doesn’t separate backend and frontend functions in this case, something to keep an eye on.