Custom template for "posts page" not working

Hi,

I think I tried everything imaginable but I’m not able to set a custom template for the post page.
In the WordPress settings I chose static page and selected a “Posts page” as well. Now I want to create a template for this “posts page” but no matter what I do Cwicly uses always the Index template for this page. I have this issue only with the “posts page”.
What am I missing here?

Hi Jonas,

Sorry you are experiencing this problem.
I just tried and found no issue on my side.

Here how I did it.

In the Dashboard, at the bottom left, click on the Cwicly menu.
You should arrive to the Cwicly Templates.
Here you can create a new Template by clicking on the Add Custom Template button.
A modal opens, asking you to give it a name, do so and click Create.

You should now see your new Template with the name you gave it, as the first item of the Templates page.
Click on the Visibility Conditions icon (an Eye) of this Template. A modal opens, click on the + Icon and set the visibility conditions as below:


Once done, close the modal and then click on the Edit Icon (the pencil) of your new Template.
Here you should access to a new Template.
Add a Cwicly Section Block, within add a CwiclyHeading Block, and right after (still within the section) a Cwicly Post Content Block.
Write something in the heading, so you can make sure where you are.
Things should look like this:

Save your changes twice, and open a page in your browser, then a post to see how both are rendered.

It works here and I hope it will work with you.

If you are looking to create a specific template for only one Page, then in the Template Conditions, change the last parameter, All for the Title of the page you would like to render.

Best,

J

1 Like

Hi J!

thank you very much for your detailed response. I appreciate it!
I have successfully created many templates. For example for archives of custom post types – there is no problem.
Lets say you create a page named “blog”. Now you create a template the way you described above but only for this specific page (this works fine also for me). Now you go to the WordPress settings and specify the page “blog” as your “posts page”. As soon as you do that your template does not work anymore and Cwicly will use the index one. At least for me. I tried this on two installations.

Thanks again for your response! :slight_smile:

1 Like

Hi @Jonas you are loosing me there:
Now you go to the WordPress settings and specify the page “blog” as your “posts page”.

What is this WordPress setting you are referring to and why do you need it for?

You find this setting here:
In WordPress go to “Settings” then to “Reading” and then you select “A static page (select below)”. Isn’t this how that works? That was always the first thing I did with a fresh WordPress install.
So I select my “Static front page” and below I choose the page I want to use as my “posts page” so the page where all my posts will be – like an archive.

Ok, well this setting is for setting what will serve as the Homepage of your site, either a single page or an archive of posts.

Try instead to use the Cwicly Themer and create a Template with Conditions:

   Show If - Singular - FrontPage

This Template should run as your homepage and not disrupt the rules of the other templates.

I hope this really help this time :wink:

Well for my front page template I selected this condition anyway – and it works great :stuck_out_tongue:

But my guess was that it is probably better to also tell WordPress what page you want to use for your posts to appear because WordPress could use that information for some stuff behind the scenes (some linking, connecting or seo?^^) That’s why I always selected my home page and the posts page in these settings.

So you never touch this settings?

Well I used these settings before, but with Cwicly, I have been working with the Themer.

1 Like

Thanks again for your help @JuGa !

1 Like

Well I don’t think I gave you any answer,
I guess you would need @Louis to understand the priorities and if not using the WP settings has any downside…

1 Like

Hi @Jonas,

Sorry to hear you’re having trouble with this.
Thanks @JuGa for your really helpful points here.

Unfortunately, it seems WordPress forces the Index - Home templates to be applied whenever you apply the Posts Page setting for a specific page.

I’ll try and dig a bit deeper in the coming days, but I can’t promise anything as quite a few of the block based functions in Gutenberg are not filterable currently… Something I’m sure they’ll be improving.
Thanks for bringing this up!

1 Like

@JuGa Well it works now and knowing that I probably don’t have to set the posts page is definitely helpful!
Also the effort counts! :slight_smile:

Thanks @Louis ! But if there is no need to set the posts page there is no need for a hurry. So please don’t feel pressured to investigate.

1 Like

Hi all,

I’m struggling a lot to make this work too…

Can’t get archive template or any custom template to work on my posts page, and can’t find any information about template priorities in documentation, how do they work?

Not setting the posts page in WP settings is not an option for me, because it will prevent from using the default query and is_home(), which I use a lot. I know I can detect the page with other native WP functions and set a custom query, but I’m also concerned about other potential cons or unknown side effects.

So it seems that we need to create a custom template for all singular (and exclude frontpage and other if needed) and keep the index template for blog page, isn’t it?

One other issue with this is that when creating a new template, Cwicly duplicates index template as a starting point.
So maybe a duplicate option should be added for all templates?
Or an option to define the default template to start with?

After a few tests, the most healthy and practical for me seems to be:

  • use index for blog (and archives and maybe search results if they share the same layout)
  • use page for all singular pages/posts (including blog posts and singular CPT posts and 404 with conditions if they share the same layout)
  • use post template if different layout from page
  • use CPT post template if different layout from page
  • use 404 if different layout from page
  • use frontpage for frontpage (automatically excluded from pages template)

This keeps everything conform to native WP and stays very modular, and doesn’t need too much condition tweaking.

I guess I’ll get used to the “index-duplicated” new templates, and I can copy paste from other template if needed.

Any news about this @Louis?

In the meantime I tried to apply frontpage template to other pages for tests purpose and I can’t get it working. Is this another WP limitation?

EDIT: I actually could make it work by excluding the pages in other templates, but it is a bit tedious.

We definitely need to know how priorities work, please.

Why would you want to use the Frontpage template on pages other than the actual front page?

It was just for testing purpose… Like showcasing the client color variations of the frontpage.

Ah, I understand. Makes sense.

@yankiara How did you get this to work?

I have my Posts page set to Blog (a page I created) in the WP settings, but literally nothing I do in the themer is allowing me to apply a template to it.

I’ve tried both editing the Index template and a new custom template. It’s just using my base Header + Footer template instead.

Edit: It seems like the only way I can get it to work is if I don’t use Show if > All for my base template.

Edit 2: Now it has the Index template showing up in places I don’t want it. Argh.

Hi @sunny,

On my side things are getting better :slight_smile:
So a little update:

1 - Priorities do work now, or at least I could finally get them to work. Maybe I was doing it wrong or it has been fixed, can’t tell.

Before I used them, I could only override my general templates (like single post) by adding and excluding pages in conditions, and this method still works.
For instance, for my alternative frontpage with different CSS only, I just added the alternative page in frontpage template AND EXCLUDED it from my single post template.

Today, I don’t need to exclude any longer pages in templates I want to override. I just use the override toggle in the new template with some priority set (doesn’t work without a priority).

This is way faster and easier ton maintain since you just have to edit the conditions of the templates you want to apply, and not the ones to exclude.

2 - As for the index template, it seems I can’t override it or even exclude the blog page from it. As @Louis, wrote, it looks like it is forced on blog page by WP by design. Maybe some relics from the time WP was only a blog engine?

3 - There are still weird things I need to work out:

Some default templates need a condition to include pages, some other don’t. For instance, search results template is automatically applied without condition to pages with ?s=.... URL, though 404 template needs manually adding singular 404 in condition.

Conclusion

All in all, it seems I can get a pretty consistent and healthy beaviour now between all templates.

The annoying exception is the rebel index template!

It is all the more frustrating that it looks it is duplicated and used as a starting content when creating a new template. I wish I could use it as a sort of blank or minimalist starting template to start all new templates, but since it is forced on blog page, it is not possible.

1 Like