[wp-trac] [WordPress Trac] #16073: Unsupported post formats still visible

WordPress Trac wp-trac at lists.automattic.com
Sun Jan 2 19:42:41 UTC 2011


#16073: Unsupported post formats still visible
--------------------------+------------------
 Reporter:  ericmann      |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  3.1
Component:  Themes        |     Version:  3.1
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |
--------------------------+------------------

Comment (by elfin):

 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.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16073#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list