Page template class messed up after update

Hey guys,

I noticed something with newly created pages as I wasn’t able to get rid of a default 50px padding added to the Icon stack.

Previously, this was automatically disabled when choosing the template “Blank no container - Header, Footer” (i.e: Template #4).

Doing so added the following body classes:

page-template page-template-template-blank-4 page-template-template-blank-4-php page page-id-22230 logged-in admin-bar theme-pro woocommerce-js x-stack-icon x-full-width-layout-active x-full-width-active x-post-meta-disabled x-child-theme-active pro-v3_0_1 cornerstone-v4_0_1 customize-support

However, analyzing a previously created page with the same template, I can see this:

page-template page-template-temp page-template-template-blank-4 page-template-temptemplate-blank-4-php page page-id-22682 logged-in admin-bar theme-pro woocommerce-js x-stack-icon x-full-width-layout-active x-full-width-active x-post-meta-disabled x-child-theme-active pro-v3_0_1 cornerstone-v4_0_1 customize-support

Note that on the newly created page, the class “page-template-temp” seems like its been truncated and the class that should help to get rid of the padding is messed up “page-template-temptemplate-blank-4-php”. It should be “page-template-template-blank-4-php”.

Waiting for your feedback!

Thanks

Found another weird thing… Looks like all templates are duplicated.

This only happens when editing with Cornerstone.

Editing with the default WP editor, templates are displayed only once. Selecting a template in Cornerstone and then going into the WP Editor, the page always use the “Default” template. Selecting the template in the WP Editor works though.

It seems like there’s some sort of glitch going on with the template list in Cornerstone editor.

Waiting for your feedback!.

Waiting for your feedback!

FYI, I often keep a folder “BAK” in the theme root folder after an update in case something is messed up so I can revert back quickly to the previous version.

I believe that’s where the wrongfully identified templates come from. I moved the BAK folder away to Twentynineteen folder temporarily and the list of template was already much better.

There are still a few of our child-theme template files that are identified as page templates.

Our search result template has nothing to do in here. This template can only be used to display a search query, not a single post or a single page. I can’t remember if this happened before but I believe that’s new. There are also a few duplicate entries, although I’m not sure where that’s coming from.

Waiting for your feedback!

Hello @thisisbbc,

Thanks for the feedback. I tried to replicate the body class issue and it is working fine from our end.
We have this:

home page-template page-template-template-blank-4 page-template-template-blank-4-php page page-id-5 logged-in admin-bar theme-pro woocommerce-js x-stack-icon x-full-width-layout-active x-content-sidebar-active x-post-meta-disabled pro-v3_0_2 cornerstone-v4_0_2 customize-support

There is no page-template-temp class in it. This may have come from your child theme. Please switch over to the parent theme and see if this still exists.

And this is only what we have if you want to select a page template:

Any additional template that displays in your list could be coming from a custom template in your child theme. We’d love to check your site if you wont mind. We might find something that you’ve missed.

Best Regards.

Hey @RueNel,

This issue still persist when using the parent theme.

This is because, as I have mentioned in my previous post, I often keep a “BAK” temporary folder in the plugin/theme root when updating versions so that I can quickly revert back to previous version in case of issues.

To put you in context, here’s our SFTP update workflow for any theme/plugin:
-> Create temporary folder “temp” in root to upload new version
-> Upload new version to “temp” folder
-> Move all files from root to temporary folder “bak” to backup old version
-> Quickly move new version from “temp” to root
-> Keep “bak” for a minimum period of time
-> If any issues, revert changes by moving “bak” to root again

It looks like Cornerstone picks up the templates in the backup folder and it causes issues if we select a template located in the BAK folder.

Note that when I remove the BAK folder, everything goes back to normal.

Maybe there’s a way to prevent this? If not, I’ll have to be careful when selecting a page or post template while there’s still a backup in the theme folder.

Waiting for your feedback!

Hello @thisisbbc,

It may not be the theme or Cornerstone. WordPress will always read and check each of the files in the child theme or parent theme. It will automatically pick up any template file that happens to have placed this line:

/*
Template Name: Sample Post layout


*/

You can even test it with Twenty Nineteen theme. The only way to keep your back up files from not being loaded by WordPress is to place them in the theme’s folder wp-content/themes/.

Hope this explains it briefly.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.