This repository has been archived by the owner on Jan 16, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current version of Soil inserts a body class by calling get_page_template().
get_page_template() actually returns page.php when it doesn't find a page template. It does this for everything, including posts. Soil then strips off the .php extension and inserts the class "page" where it doesn't belong. This is particularly problematic if you use .post and .page as CSS selectors, which many people do. The only page that should have the class "page" in WP is a page.
We could add a conditional check to watch for pages, or could use get_template_slug(), which doesn't fall back to page.php here, and only returns a template slug if one is set. However, I propose that we delete it completely.
WP already outputs the page template slug as a body class, if a page template is set. It is a bit longer, but still can be used, for example page-template-template-name. This function is actually introducing unnecessary duplication in the body class, by also inserting "template-name", without the "page-template" bit. Seems unnecessary to include two classes for the same page template, unless I'm missing the use case here.