WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#36972 closed enhancement (wontfix)

Add version number for all single PHP files in bundled themes

Reported by: zodiac1978 Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.6
Component: Bundled Theme Keywords:
Focuses: Cc:
PR Number:

Description

I've made a plugin called child theme check to keep track of changes in the parent theme (See: https://wordpress.org/plugins/child-theme-check/)

This would prevent security holes / missing features through unchanged files in child themes after an (security/feature) update of the parent theme.

There are slides from my talk at WordCamp Cologne which are explaining the issue that is solved by the plugin:
http://de.slideshare.net/zodiac1978/the-child-theme-dilemma-en

WooCommerce has a similar system to show outdated plugin template files:
http://speakinginbytes.com/2014/02/woocommerce-2-1-outdated-templates/

There is Pull Request for the Theme Check plugin, too:
https://github.com/Otto42/theme-check/issues/115

I'm interested in opinions. Good idea? Maybe we can test this with the next default theme?

Change History (6)

#1 @karmatosed
4 years ago

Can you suggest what a patch would contain as then we can judge this better. Is it similar to core or something different?

#2 @zodiac1978
4 years ago

As the title says, I suggest adding a version number in every PHP template file in a (bundled) theme which could be overridden by a child theme (so for for a functions.php this doesn't make any sense).

As an example I took the doc block from search.php of Twenty Fifteen. My suggestion would be changing:

/**
 * The template for displaying search results pages.
 *
 * @package WordPress
 * @subpackage Twenty_Fifteen
 * @since Twenty Fifteen 1.0
 */

to this:

/**
 * The template for displaying search results pages.
 *
 * @package WordPress
 * @subpackage Twenty_Fifteen
 * @since Twenty Fifteen 1.0
 * @version 1.0.0
 */

If you copy the file to your child theme the version number can now be used to check if an update of the parent theme (in this case Twenty Fifteen) is relevant for your child theme and you maybe should add the changes manually to your child theme. This is the idea of the plugin and in the end my idea for core, but I thought this could be a first step.

I know that this is not easy to add for an existing theme, so maybe we start using that in the next bundled theme?

Last edited 4 years ago by zodiac1978 (previous) (diff)

#3 @karmatosed
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

@zodiac1978 I think you're right and this should go in from the next. With that in mind, we can consider this during the development and I'll close here now. Thanks for the suggestion.

#4 @zodiac1978
3 years ago

@karmatosed If you think this should go in and we are considering it, why do we close it here? Maybe I don't understand something here, but for me "Wontfix" means you don't want to implement it at all. Wouldn't it be better to leave this ticket open or if this is a trac workflow problem, set it to "maybelater" instead of "wontfix"?

#5 @karmatosed
3 years ago

@zodiac1978 won't fix in this sense is in current versions, as future versions aren't on trac (and may not be just like Twenty Sixteen), it's correct to close.

#6 @zodiac1978
3 years ago

@karmatosed Great, thanks for the clarification!

Note: See TracTickets for help on using tickets.