[wp-trac] [WordPress Trac] #25070: Add filter to use do_accordion_sections for post metaboxes

WordPress Trac noreply at wordpress.org
Sun Aug 18 15:53:31 UTC 2013


#25070: Add filter to use do_accordion_sections for post metaboxes
----------------------------+------------------------------
 Reporter:  MZAWeb          |       Owner:
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Administration  |     Version:  3.6
 Severity:  normal          |  Resolution:
 Keywords:  2nd-opinion     |
----------------------------+------------------------------

Comment (by MZAWeb):

 Sample usage:


 {{{
 add_filter( 'meta_boxes_style',           'set_custom_meta_box_style',
 10, 4 );
 add_filter( 'render_meta_boxes_my_style',
 'render_custom_meta_box_my_style', 10, 4 );

 function set_custom_meta_box_style( $style, $screen, $context, $object ) {

         if ( $context == 'normal' )
                 $style = 'accordion';

         if ( $context == 'side' )
                 $style = 'my_style';

         return $style;
 }

 function render_custom_meta_box_my_style( $i, $screen, $context, $object )
 {

         // Do something fancy here.
         global $wp_meta_boxes;

         if ( empty( $screen ) )
                 $screen = get_current_screen();
         elseif ( is_string( $screen ) )
                 $screen = convert_to_screen( $screen );

         var_dump( $wp_meta_boxes[$screen->id][$context] );

         return $i;
 }
 }}}

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


More information about the wp-trac mailing list