[wp-trac] [WordPress Trac] #13305: Allow multiple post types to use same add_meta_box call (Pass an array for the $page arg)

WordPress Trac wp-trac at lists.automattic.com
Tue Aug 31 15:39:44 UTC 2010


#13305: Allow multiple post types to use same add_meta_box call (Pass an array for
the $page arg)
-------------------------+--------------------------------------------------
 Reporter:  idealien     |        Owner:                 
     Type:  enhancement  |       Status:  closed         
 Priority:  normal       |    Milestone:  Awaiting Triage
Component:  Post Types   |      Version:                 
 Severity:  normal       |   Resolution:  wontfix        
 Keywords:               |  
-------------------------+--------------------------------------------------
Changes (by markjaquith):

  * status:  new => closed
  * resolution:  => wontfix


Comment:

 Just leverage the variables passed to the do_meta_boxes callback.

 {{{
 function your_callback( $page, $context ) {
     if ( in_array( $page,  array( 'post', 'page' ) ) && 'normal' ==
 $context )
         add_meta_box( 'your-id', 'Title', 'your_box_callback', $page,
 $context, 'high' );
 }

 add_action( 'do_meta_boxes', 'your_callback', 10, 2 );
 }}}

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


More information about the wp-trac mailing list