Opened 15 years ago
Closed 15 years ago
#16073 closed defect (bug) (fixed)
Unsupported post formats still visible
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | 3.1 | Priority: | normal |
| Severity: | normal | Version: | 3.1 |
| Component: | Themes | Keywords: | has-patch commit needs-testing |
| Focuses: | Cc: |
Description
Using the latest build (3.1 RC2), ff you add theme support for an unknown post-format it appears on the edit screen, but with a blank label.
Test with the following:
add_theme_support( 'post-formats', array( 'aside', 'gallery','bug' ) );
You will see 4 radio buttons and 3 visible labels: Standard, Aside, Gallery. The 4th label markup is there, but with no visible text.
Attachments (5)
Change History (15)
#1
@
15 years ago
Tested and seems to work, but should this be 'patched' or should a check_post_formats function be created now for future usage.
#2
follow-up:
↓ 5
@
15 years ago
- Milestone changed from Awaiting Review to 3.1
Maybe we can remove these at the add_theme_support level by doing a diff with get_post_format_slugs.
#3
@
15 years ago
probably need to do something, the diff isn't taking into account options-writing.php which has a selection for the default post-format.
#4
@
15 years ago
Suggestion then. in theme.php change the function add_theme_support to this:
function add_theme_support( $feature ) {
global $_wp_theme_features;
if ( func_num_args() == 1 )
$_wp_theme_features[$feature] = true;
else
$_wp_theme_features[$feature] = array_slice( func_get_args(), 1 );
if ( $feature == 'post-formats' )
$_wp_theme_features[$feature] = check_post_format_support($_wp_theme_features[$feature]);
}
and add this function to that file:
function check_post_format_support( $theme_post_formats ) {
$allowed_post_formats = array_keys(get_post_format_strings());
$checked_post_formats = array();
foreach ( $theme_post_formats[0] as $check_format ) {
if ( in_array ( $check_format, $allowed_post_formats ) ) {
$checked_post_formats[] = $check_format;
}
}
$return_post_formats[0]=$checked_post_formats;
return $return_post_formats;
}
Although there is almost certainly an easier way of doing it.
#5
in reply to:
↑ 2
@
15 years ago
Replying to nacin:
Maybe we can remove these at the add_theme_support level by doing a diff with get_post_format_slugs.
Done.
Check to make sure the post format string exists ( != ) before adding its markup to the UI.