Opened 12 years ago
Last modified 6 months ago
#26516 assigned enhancement
Make it easier to check theme support
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 2.9 |
| Component: | Themes | Keywords: | has-patch dev-feedback |
| Focuses: | Cc: |
Description (last modified by )
Currently we don't make it too easy for plugins (and themes I suppose) to get access to the information passed in the second argument to add_theme_support().
To get more information about a theme's support for post thumbnails for example, a plugin would have to assign the return value of get_theme_support() to a variable and then access the value stored in the first key of the returned array:
<?php $support = get_theme_support( 'post-thumbnails' ); $actual_support = $support[0];
While this is not ideal for core features that themes need to register support for, it gets painful quickly when themes and plugins want to deal with information coupled to a custom feature.
Attachments (3)
Change History (10)
@
12 years ago
Adds some documentation and makes sure current_theme_supports() always returns a boolean.
This ticket was mentioned in IRC in #wordpress-dev by DH-Shredder. View the logs.
12 years ago
#4
@
12 years ago
- Milestone changed from Awaiting Review to Future Release
Hi obenland!
I'm sorry it took so long for you to get a reply!
I've refreshed the patch so that it applies cleanly on trunk, and tested it. It appears to work as advertised.
The duplication of returned information seems a little strange, but back-compat often is.
@nacin noted in the chat linked above that a whitelist for support may be appropriate.
#6
@
6 months ago
- Keywords close added
Hi All,
I have just taken a quick look into this, and it looks that in the 2.9 release, support was added for this functionality through the current_theme_supports() function. Due to this and the extreme age of this ticket, I suggest that this issue has already been resolved within core and we move to close this ticket. As of such I have attached the close tag, but welcome any feedback prior to this ticket closing down completely. 😃
Attached patch merges the array with the array of information, with the array of information. The result would look like this: