WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 6 months ago

#16395 closed enhancement (wontfix)

Add 'Template Version' for use with 'Template' in Child-Themes

Reported by: cais Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: Themes Keywords: has-patch needs-unit-tests close
Focuses: Cc:

Description

From the discussions on the http://make.wordpress.org/themes/ site I am suggesting the addition of 'Template Version' for inclusion into the get_theme_data() function to be used as a reference for a Child-Theme's compatibility with its Parent-Theme ('Template').

PS: This is my first "patch" submission, any constructive feedback would be greatly appreciated. EAC

Attachments (2)

theme.php.diff (2.2 KB) - added by cais 5 years ago.
16395.patch (2.2 KB) - added by cais 10 months ago.
Modified class-wp-theme.php file (only)

Download all attachments as: .zip

Change History (15)

@cais
5 years ago

#1 @pross
5 years ago

  • Cc pross@… added

#2 @kawauso
5 years ago

  • Keywords has-patch added; child-theme removed

#3 @GaryJ
5 years ago

  • Cc GaryJ added

#4 @lancewillett
5 years ago

  • Cc lance@… added

#5 @cais
5 years ago

  • Version set to 3.1
Version 0, edited 5 years ago by cais (next)

#7 @cais
4 years ago

Related: #16868 - updated patch on #16868 takes into account this ticket

#8 follow-up: @chriscct7
10 months ago

  • Keywords needs-refresh added

#9 in reply to: ↑ 8 @cais
10 months ago

Replying to chriscct7:

Refreshed ... see 16395.patch (attached)

@cais
10 months ago

Modified class-wp-theme.php file (only)

#10 follow-up: @swissspidy
6 months ago

  • Keywords needs-unit-tests added; needs-refresh removed

An alternative to having a global Template Version field is to declare the template version for each template file (e.g. by adding @version xy to each PHP file), similar to how WooCommerce does it.

That way developers can check for the individual theme files that need an update instead of checking the whole parent theme when it gets updated. See https://wordpress.org/plugins/child-theme-check/ for a plugin that implements such a check.

It is not a dependency thing though, just for versioning.

#11 in reply to: ↑ 10 @cais
6 months ago

Replying to swissspidy:

An alternative to having a global Template Version field is to declare the template version for each template file (e.g. by adding @version xy to each PHP file), similar to how WooCommerce does it.

That way developers can check for the individual theme files that need an update instead of checking the whole parent theme when it gets updated. See https://wordpress.org/plugins/child-theme-check/ for a plugin that implements such a check.

I can definitely see this idea as working in conjunction with this ticket but I'm not seeing it as an alternative. The premise is for Child-Theme authors to be aware of and note which Parent-Theme version the Child-Theme was last known to be compatible with in an overall sense. This is much along the same lines that the "Requires at least" reference in plugins is used ... in my mind, this is where the idea originated from.

#12 @dd32
6 months ago

  • Keywords close added

I'll just put it this way: Why?

I think that this should be defined in the themes documentation, and assumed that child themes are compatible with all parent theme versions, or at the least, with the latest version of the theme. That won't hold true for overly complex themes which have no form of backwards/forwards compatibility, but there's only so much that we could do in that case.

Furthermore, the patches here don't actually do anything, other than retrieving the data from the theme, it doesn't actually use it for anything. I assume that's because you want core to read it as some kind of way of saying "This is a legitimate header you should use", but if core doesn't use it, supporting it on this end makes no sense.

#13 @obenland
6 months ago

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

This is also something I don't think users should have to be worried about. It's unreasonable to ask users to figure out how to download an outdate version of a parent theme from the directory because the child theme they chose doesn't support the latest version. Child theme authors should have an incentive for keeping their themes up to date with their parent themes, introducing a way out would discourage that.

Note: See TracTickets for help on using tickets.