Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




do_meta_boxes [ WordPress Function ]

do_meta_boxes ( $screen, $context, $object )
Parameters:
  • (string|object) $screen Screen identifier
  • (string) $context box context
  • (mixed) $object gets passed to the box callback function as first parameter
Returns:
  • (int) number of meta_boxes
Defined at:



Meta-Box template function

Source


<?php
function do_meta_boxes$screen$context$object ) {
    global 
$wp_meta_boxes;
    static 
$already_sorted false;

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

    
$page $screen->id;

    
$hidden get_hidden_meta_boxes$screen );

    
printf('<div id="%s-sortables" class="meta-box-sortables">'htmlspecialchars($context));

    
$i 0;
    do {
        
// Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
        
if ( !$already_sorted && $sorted get_user_option"meta-box-order_$page) ) {
            foreach ( 
$sorted as $box_context => $ids ) {
                foreach ( 
explode(','$ids ) as $id ) {
                    if ( 
$id && 'dashboard_browser_nag' !== $id )
                        
add_meta_box$idnullnull$screen$box_context'sorted' );
                }
            }
        }
        
$already_sorted true;

        if ( !isset(
$wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context]) )
            break;

        foreach ( array(
'high''sorted''core''default''low') as $priority ) {
            if ( isset(
$wp_meta_boxes[$page][$context][$priority]) ) {
                foreach ( (array) 
$wp_meta_boxes[$page][$context][$priority] as $box ) {
                    if ( 
false == $box || ! $box['title'] )
                        continue;
                    
$i++;
                    
$style '';
                    
$hidden_class in_array($box['id'], $hidden) ? ' hide-if-js' '';
                    echo 
'<div id="' $box['id'] . '" class="postbox ' postbox_classes($box['id'], $page) . $hidden_class '" ' '>' "\n";
                    if ( 
'dashboard_browser_nag' != $box['id'] )
                        echo 
'<div class="handlediv" title="' esc_attr__('Click to toggle') . '"><br /></div>';
                    echo 
"<h3 class='hndle'><span>{$box['title']}</span></h3>\n";
                    echo 
'<div class="inside">' "\n";
                    
call_user_func($box['callback'], $object$box);
                    echo 
"</div>\n";
                    echo 
"</div>\n";
                }
            }
        }
    } while(
0);

    echo 
"</div>";

    return 
$i;

}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics