WordPress.org

Making WordPress.org

Opened 6 months ago

Last modified 8 weeks ago

#3718 new task

Theme Directory: Allow minimum WP and PHP version requirement

Reported by: flixos90 Owned by:
Milestone: Priority: normal
Component: Theme Directory Keywords: has-patch
Cc:

Description

As a follow up to https://core.trac.wordpress.org/ticket/40934 and #2952, this ticket aims to add headers for version requirements to WordPress themes.

Themes do not always support all WordPress versions (for example Twenty Seventeen requires WP 4.7), and, while that is not a common practice seen so far, there are also themes that require a higher PHP version than 5.2. Core should highlight such incompatibilities, but as a prerequisite we need to allow theme authors to indicate required versions.

Attachments (1)

3718.diff (52.1 KB) - added by flixos90 6 months ago.

Download all attachments as: .zip

Change History (18)

@flixos90
6 months ago

#1 @flixos90
6 months ago

3718.diff adds support for a Requires header (for required WP version) and a Requires PHP header (for required PHP version). While we could go with Requires WP, I thought it would make sense to align the names with the names of the plugin headers, so people can remember them easily for both plugins and themes.

As far as I can tell, my patch covers all areas necessary to have full support for those headers, but since I haven't contributed to the theme directory meta part before, I might have missed something else.

Also, be aware that this patch would require https://core.trac.wordpress.org/ticket/44592 to be merged into core first, in order to have support for the two headers in the WP_Theme class, which is also used by the theme directory plugin.

#2 @flixos90
6 months ago

  • Keywords has-patch added; needs-patch removed

This ticket was mentioned in Slack in #core-php by flixos90. View the logs.


6 months ago

#4 @dd32
6 months ago

FWIW I think this is part of the bigger discussion around Theme Meta. Unlike the Plugin Directory, Themes have no way to define extra meta-data like this, or even to have a theme description that isn't one-long-line-that's-unreadable-because-it-just-keeps-on-going-on-and-on.

The patch as-is adds it to the Theme style.css headers, which seems like the wrong place for it - but the only place we currently have.
All new themes in the repo need to have a readme.txt - but the theme directory doesn't parse anything from it - #215

To me, it feels like the implementation should match what plugins have, where it's included in the readme (which is where all the Metadata ultimately comes from).

I have a feeling that borrowing the plugin directory readme parser and only supporting headers / description wouldn't require too much effort here and would provide for a much better platform for future changes (such as supporting a minimum WP version requirement too, etc)

This ticket was mentioned in Slack in #core-php by schlessera. View the logs.


6 months ago

This ticket was mentioned in Slack in #meta by tellyworth. View the logs.


6 months ago

#7 follow-up: @afragen
6 months ago

I agree that having new themes require a readme.txt file is the path forward. Parity with the plugin directory makes the most sense as does using the same parser.

For existing themes that don’t have a readme.txt file couldn’t we create a parsed data array from the info we do have and use that if no actual reader.txt file exists?

#8 in reply to: ↑ 7 ; follow-up: @dd32
6 months ago

Replying to afragen:

For existing themes that don’t have a readme.txt file couldn’t we create a parsed data array from the info we do have and use that if no actual reader.txt file exists?

That's what would happen, yes.

I'm simply suggesting that skipping this header entirely and pulling at least that info from the readme would be a better long-term solution

#9 in reply to: ↑ 8 @afragen
6 months ago

Replying to dd32:

I'm simply suggesting that skipping this header entirely and pulling at least that info from the readme would be a better long-term solution

Agreed. I don’t think the style.css file needs to be parsed at all. I would suggest the following process for getting the information.

  1. Parse an existing readme.
  2. Use the API to get existing data, eg. https://api.wordpress.org/themes/info/1.2/?action=theme_information&request[slug]=twentyten

We might be referring to the same process by different names. I’m not sure.

Last edited 6 months ago by afragen (previous) (diff)

This ticket was mentioned in Slack in #meta by sergey. View the logs.


3 months ago

#11 @SergeyBiryukov
3 months ago

Last edited 3 months ago by SergeyBiryukov (previous) (diff)

This ticket was mentioned in Slack in #themereview by joyously. View the logs.


3 months ago

This ticket was mentioned in Slack in #themereview by joyously. View the logs.


3 months ago

This ticket was mentioned in Slack in #core-php by sergey. View the logs.


2 months ago

This ticket was mentioned in Slack in #design by boemedia. View the logs.


2 months ago

This ticket was mentioned in Slack in #core-php by afragen. View the logs.


2 months ago

This ticket was mentioned in Slack in #themereview by andreiglingeanu. View the logs.


8 weeks ago

Note: See TracTickets for help on using tickets.