WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 20 months ago

#16883 new enhancement

Add check for "Template Version" on theme activation

Reported by: nathanrice Owned by:
Priority: normal Milestone: Awaiting Review
Component: Themes Version: 3.1
Severity: normal Keywords: needs-patch 2nd-opinion
Cc: nathanrice, mikeschinkel@…, edward.caissie@…, travis@…, lance@…, 24-7@…

Description

Related: #16395

In addition to adding Template Version to the standard meta information extracted from style.css in get_theme_data(), I think that for this information to be useful, a child theme shouldn't be able to be activated unless the template template the child theme uses (parent theme) meets the minimum version requirement identified in "Template Version".

A polite and graceful failure, with an error notice, would be preferable :-)

Reason: many times child themes utilize functionality that only exists in the latest version of a parent theme. They're stuck either writing backward compatibility into into their code, or risking whitescreens.

This not only prevents that, but it could be used to gently encourage the user to update the parent theme.

Certainly not a candidate for 3.1.1, but perhaps 3.2?

Change History (9)

comment:1 mikeschinkel2 years ago

  • Cc mikeschinkel@… added

comment:2 cais2 years ago

The "Template Version" represents the Parent-Theme version the Child-Theme was written for. The implication is to insure the Child-Theme author maintains its code to match the current Parent-Theme in the repository.

An unobtrusive notice to advise the end-user the Child-Theme's Template (Parent-Theme) Version has been raised would be nice as a reminder but may also be detrimental to the overall UX.

comment:3 cais2 years ago

  • Cc edward.caissie@… added

comment:4 nathanrice2 years ago

@cais
Yes, that's what I'm saying. Hopefully the ticket wording isn't unclear. The Template Version tag is a way for the child theme to say "I require AT LEAST {Template Version} to run properly. If {Template} isn't at least {Template Version}, don't let me activate, and provide a nice little message to anyone who tries to activate me that says 'This theme requires {Template} {Template Version}. Please upgrade {Template}'"

Basically, it'd be nice if Template Version wasn't just a suggestion or reminder. It'd be nice if it had actual functional utility. I think that UX beats the pants off of whitescreens due to a child theme calling a function that doesn't exist in their version of {Template}.

comment:5 cais2 years ago

@nathanrice - We seem to be writing about the same basic idea ... part of the utility of "Template Version" is to test for the Parent-Theme version at upload / submission.

Have a look at the "Theme Check" plugin, it is already implementing this to a degree.

I imagine adding the additional UX functionality you are suggesting could also be implemented.

comment:6 smub2 years ago

This is a great idea Nathan. This would certainly help keep the standards high.

comment:7 travisnorthcutt2 years ago

  • Cc travis@… added

comment:8 lancewillett2 years ago

  • Cc lance@… added

comment:9 F J Kaiser20 months ago

  • Cc 24-7@… added
Note: See TracTickets for help on using tickets.