Get rid of "Theme without sidebar is deprecated"

This is just a placeholder for a PR I will create as soon I have time, letting users vote here if they want, if there are a lot of votes I will prioritise it.
If there are arguments against it, please let me know, after consideration I will of course if applicable not PR…


Simply get rid of this PHP Deprecated: Theme without sidebar.php is <strong>deprecated</strong> since version 3.0.0 with no alternative available. Please include a sidebar.php template in your theme.

Why can I not decide what a theme has in it?
What if I want a theme with just an index.php? I am not free to do that?

It is an 18 steps long debug trace, just to tell me I am forced to add a sidebar that eventually no one ver uses?
This is literal nonsense IMO.

What a can of worms.

I am wondering if we cannot delete the whole wp-includes/theme-compat/ folder?

As a matter of fact it seems that with wp 4.5 one of the long deprecated files (this folder is a horror) was removed (seen in “old files”):

// 4.5
'wp-includes/theme-compat/comments-popup.php',

So I am wondering what keeps us from removing the rest.
Those files are there as sort of “drop ins” if the theme does not include them for some reason.
This is very old stuff.
The way it “works” is that if I delete my header.php in my theme the header.php fallback is used for example. (
But do we really need things like that?

The files even say This file is here for backward compatibility with old themes and will be removed in a future version.
So I guess this is a good moment to call that the “future”?

2 Likes

New Branch https://github.com/TukuToi/ClassicPress/tree/TukuToi-no-themecompat where I removed those files and added them to the _old_files array

Gonna test it tomorrow with a few skewed themes to see what happens and with a few “proper” themes.

2 Likes

I am not a dev. From a user perspective, if you plan to remove something when releasing 4.5 for backwards compat (aka to give enough time to people to do the thing in the new way and get accustomed to it) how much time is proper to wait before removing?
WP is near v. 6
And WP 4.9 itself morphed into CP (that to be honest can be considered a version upgrade).
Has WP removed those files or are they still pending there?
To me it seems it could be good to remove them. We don’t have CP themes yet, and when we will have them they are going to do things the new way.

3 Likes

Yes, you’re right about announcing this - it has been, since wp 3.0 (through appropriate debug notices). We could maybe just for the sake of complete make a post about IF we agree to remove it.

The files are still there in wp. I guess it’s just been forgotten.

Maybe @joyously knows more about this, since she does theme reviews on WP side.

Yes, you are allowed to do that as far as php goes. You still need style.css though.
And you won’t see this deprecation notice unless you call get_sidebar(), at which time it is still correct that you should have your own sidebar.php if you are going to call for a sidebar instead of using the theme-compat one.

You can, but you need to remove where it is used. One place is in locate_template().
See locate_template() | Function | ClassicPress Documentation
The locate_template function does nothing if none of the files are found.

To me, it is a friendly way to tell a theme developer how to fix an error of omission.

I did theme reviews, past tense. Their theme handbook lists required files as style.css, index.php, comments.php, screenshot.

3 Likes

I agree that in this case, notice is appropriate.
But that was not the case when I saw it. My theme does not call that function.
Let me test this again to be sure.

Thanks for the hint on the function where it’s used, I will check on that (I also saw a few comments in core for inline documentation (like the screen help thing) that mentions sidebars, so I have to check on that too)

I don’t think that comments.php should be required. It is not needed for a theme to function, per se. the style css is needed because of its header. The index is needed because of its fallback in hierarchy.
It is a source of disappointment to even have comments in core, so I guess we could remove that requirement?

This is out of scope for this petition. The requirement is from a doc at WP for their repo. I’m not sure what the core code checks for on the Themes admin page. As for CP theme requirements, I would require that all of the core options are handled. When you get into moving code to core plugins, it makes it more difficult to support all the “options”, because you would have to conditionally support, although if they are actions, it’s easier.

1 Like

Please correct me if I’m wrong, based on what I read here, this petition can be closed as it doesn’t cause any issues but provides help to theme developers.

1 Like

This topic was automatically closed after 3 days. New replies are no longer allowed.