do_accordion_sections

The timeline below displays how wordpress function do_accordion_sections has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.4

/**
 * Meta Box Accordion Template Function.
 *
 * Largely made up of abstracted code from do_meta_boxes(), this
 * function serves to build meta boxes as list items for display as
 * a collapsible accordion.
 *
 * @since 3.6.0
 *
 * @uses global $wp_meta_boxes Used to retrieve registered meta boxes.
 *
 * @param string|object $screen      The screen identifier.
 * @param string        $context     The screen context for which to display accordion sections.
 * @param mixed         $data_object Gets passed to the section callback function as the first parameter.
 * @return int Number of meta boxes as accordion sections.
 */
function do_accordion_sections($screen, $context, $data_object)
{
    global $wp_meta_boxes;
    wp_enqueue_script('accordion');
    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);
    ?>
	<div id="side-sortables" class="accordion-container">
		<ul class="outer-border">
	<?php 
    $i = 0;
    $first_open = false;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ($wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false === $box || !$box['title']) {
                        continue;
                    }
                    ++$i;
                    $hidden_class = in_array($box['id'], $hidden, true) ? 'hide-if-js' : '';
                    $open_class = '';
                    if (!$first_open && empty($hidden_class)) {
                        $first_open = true;
                        $open_class = 'open';
                    }
                    ?>
					<li class="control-section accordion-section <?php 
                    echo $hidden_class;
                    ?> <?php 
                    echo $open_class;
                    ?> <?php 
                    echo esc_attr($box['id']);
                    ?>" id="<?php 
                    echo esc_attr($box['id']);
                    ?>">
						<h3 class="accordion-section-title hndle" tabindex="0">
							<?php 
                    echo esc_html($box['title']);
                    ?>
							<span class="screen-reader-text">
								<?php 
                    /* translators: Hidden accessibility text. */
                    _e('Press return or enter to open this section');
                    ?>
							</span>
						</h3>
						<div class="accordion-section-content <?php 
                    postbox_classes($box['id'], $page);
                    ?>">
							<div class="inside">
								<?php 
                    call_user_func($box['callback'], $data_object, $box);
                    ?>
							</div><!-- .inside -->
						</div><!-- .accordion-section-content -->
					</li><!-- .accordion-section -->
					<?php 
                }
            }
        }
    }
    ?>
		</ul><!-- .outer-border -->
	</div><!-- .accordion-container -->
	<?php 
    return $i;
}

WordPress Version: 6.2

/**
 * Meta Box Accordion Template Function.
 *
 * Largely made up of abstracted code from do_meta_boxes(), this
 * function serves to build meta boxes as list items for display as
 * a collapsible accordion.
 *
 * @since 3.6.0
 *
 * @uses global $wp_meta_boxes Used to retrieve registered meta boxes.
 *
 * @param string|object $screen      The screen identifier.
 * @param string        $context     The screen context for which to display accordion sections.
 * @param mixed         $data_object Gets passed to the section callback function as the first parameter.
 * @return int Number of meta boxes as accordion sections.
 */
function do_accordion_sections($screen, $context, $data_object)
{
    global $wp_meta_boxes;
    wp_enqueue_script('accordion');
    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);
    ?>
	<div id="side-sortables" class="accordion-container">
		<ul class="outer-border">
	<?php 
    $i = 0;
    $first_open = false;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ($wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false === $box || !$box['title']) {
                        continue;
                    }
                    $i++;
                    $hidden_class = in_array($box['id'], $hidden, true) ? 'hide-if-js' : '';
                    $open_class = '';
                    if (!$first_open && empty($hidden_class)) {
                        $first_open = true;
                        $open_class = 'open';
                    }
                    ?>
					<li class="control-section accordion-section <?php 
                    echo $hidden_class;
                    ?> <?php 
                    echo $open_class;
                    ?> <?php 
                    echo esc_attr($box['id']);
                    ?>" id="<?php 
                    echo esc_attr($box['id']);
                    ?>">
						<h3 class="accordion-section-title hndle" tabindex="0">
							<?php 
                    echo esc_html($box['title']);
                    ?>
							<span class="screen-reader-text">
								<?php 
                    /* translators: Hidden accessibility text. */
                    _e('Press return or enter to open this section');
                    ?>
							</span>
						</h3>
						<div class="accordion-section-content <?php 
                    postbox_classes($box['id'], $page);
                    ?>">
							<div class="inside">
								<?php 
                    call_user_func($box['callback'], $data_object, $box);
                    ?>
							</div><!-- .inside -->
						</div><!-- .accordion-section-content -->
					</li><!-- .accordion-section -->
					<?php 
                }
            }
        }
    }
    ?>
		</ul><!-- .outer-border -->
	</div><!-- .accordion-container -->
	<?php 
    return $i;
}

WordPress Version: 6.1

/**
 * Meta Box Accordion Template Function.
 *
 * Largely made up of abstracted code from do_meta_boxes(), this
 * function serves to build meta boxes as list items for display as
 * a collapsible accordion.
 *
 * @since 3.6.0
 *
 * @uses global $wp_meta_boxes Used to retrieve registered meta boxes.
 *
 * @param string|object $screen      The screen identifier.
 * @param string        $context     The screen context for which to display accordion sections.
 * @param mixed         $data_object Gets passed to the section callback function as the first parameter.
 * @return int Number of meta boxes as accordion sections.
 */
function do_accordion_sections($screen, $context, $data_object)
{
    global $wp_meta_boxes;
    wp_enqueue_script('accordion');
    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);
    ?>
	<div id="side-sortables" class="accordion-container">
		<ul class="outer-border">
	<?php 
    $i = 0;
    $first_open = false;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ($wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false === $box || !$box['title']) {
                        continue;
                    }
                    $i++;
                    $hidden_class = in_array($box['id'], $hidden, true) ? 'hide-if-js' : '';
                    $open_class = '';
                    if (!$first_open && empty($hidden_class)) {
                        $first_open = true;
                        $open_class = 'open';
                    }
                    ?>
					<li class="control-section accordion-section <?php 
                    echo $hidden_class;
                    ?> <?php 
                    echo $open_class;
                    ?> <?php 
                    echo esc_attr($box['id']);
                    ?>" id="<?php 
                    echo esc_attr($box['id']);
                    ?>">
						<h3 class="accordion-section-title hndle" tabindex="0">
							<?php 
                    echo esc_html($box['title']);
                    ?>
							<span class="screen-reader-text"><?php 
                    _e('Press return or enter to open this section');
                    ?></span>
						</h3>
						<div class="accordion-section-content <?php 
                    postbox_classes($box['id'], $page);
                    ?>">
							<div class="inside">
								<?php 
                    call_user_func($box['callback'], $data_object, $box);
                    ?>
							</div><!-- .inside -->
						</div><!-- .accordion-section-content -->
					</li><!-- .accordion-section -->
					<?php 
                }
            }
        }
    }
    ?>
		</ul><!-- .outer-border -->
	</div><!-- .accordion-container -->
	<?php 
    return $i;
}

WordPress Version: 5.5

/**
 * Meta Box Accordion Template Function.
 *
 * Largely made up of abstracted code from do_meta_boxes(), this
 * function serves to build meta boxes as list items for display as
 * a collapsible accordion.
 *
 * @since 3.6.0
 *
 * @uses global $wp_meta_boxes Used to retrieve registered meta boxes.
 *
 * @param string|object $screen  The screen identifier.
 * @param string        $context The screen context for which to display accordion sections.
 * @param mixed         $object  Gets passed to the section callback function as the first parameter.
 * @return int Number of meta boxes as accordion sections.
 */
function do_accordion_sections($screen, $context, $object)
{
    global $wp_meta_boxes;
    wp_enqueue_script('accordion');
    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);
    ?>
	<div id="side-sortables" class="accordion-container">
		<ul class="outer-border">
	<?php 
    $i = 0;
    $first_open = false;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ($wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false === $box || !$box['title']) {
                        continue;
                    }
                    $i++;
                    $hidden_class = in_array($box['id'], $hidden, true) ? 'hide-if-js' : '';
                    $open_class = '';
                    if (!$first_open && empty($hidden_class)) {
                        $first_open = true;
                        $open_class = 'open';
                    }
                    ?>
					<li class="control-section accordion-section <?php 
                    echo $hidden_class;
                    ?> <?php 
                    echo $open_class;
                    ?> <?php 
                    echo esc_attr($box['id']);
                    ?>" id="<?php 
                    echo esc_attr($box['id']);
                    ?>">
						<h3 class="accordion-section-title hndle" tabindex="0">
							<?php 
                    echo esc_html($box['title']);
                    ?>
							<span class="screen-reader-text"><?php 
                    _e('Press return or enter to open this section');
                    ?></span>
						</h3>
						<div class="accordion-section-content <?php 
                    postbox_classes($box['id'], $page);
                    ?>">
							<div class="inside">
								<?php 
                    call_user_func($box['callback'], $object, $box);
                    ?>
							</div><!-- .inside -->
						</div><!-- .accordion-section-content -->
					</li><!-- .accordion-section -->
					<?php 
                }
            }
        }
    }
    ?>
		</ul><!-- .outer-border -->
	</div><!-- .accordion-container -->
	<?php 
    return $i;
}

WordPress Version: 5.1

/**
 * Meta Box Accordion Template Function.
 *
 * Largely made up of abstracted code from do_meta_boxes(), this
 * function serves to build meta boxes as list items for display as
 * a collapsible accordion.
 *
 * @since 3.6.0
 *
 * @uses global $wp_meta_boxes Used to retrieve registered meta boxes.
 *
 * @param string|object $screen  The screen identifier.
 * @param string        $context The meta box context.
 * @param mixed         $object  gets passed to the section callback function as first parameter.
 * @return int number of meta boxes as accordion sections.
 */
function do_accordion_sections($screen, $context, $object)
{
    global $wp_meta_boxes;
    wp_enqueue_script('accordion');
    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);
    ?>
	<div id="side-sortables" class="accordion-container">
		<ul class="outer-border">
	<?php 
    $i = 0;
    $first_open = false;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ($wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $i++;
                    $hidden_class = in_array($box['id'], $hidden) ? 'hide-if-js' : '';
                    $open_class = '';
                    if (!$first_open && empty($hidden_class)) {
                        $first_open = true;
                        $open_class = 'open';
                    }
                    ?>
					<li class="control-section accordion-section <?php 
                    echo $hidden_class;
                    ?> <?php 
                    echo $open_class;
                    ?> <?php 
                    echo esc_attr($box['id']);
                    ?>" id="<?php 
                    echo esc_attr($box['id']);
                    ?>">
						<h3 class="accordion-section-title hndle" tabindex="0">
							<?php 
                    echo esc_html($box['title']);
                    ?>
							<span class="screen-reader-text"><?php 
                    _e('Press return or enter to open this section');
                    ?></span>
						</h3>
						<div class="accordion-section-content <?php 
                    postbox_classes($box['id'], $page);
                    ?>">
							<div class="inside">
								<?php 
                    call_user_func($box['callback'], $object, $box);
                    ?>
							</div><!-- .inside -->
						</div><!-- .accordion-section-content -->
					</li><!-- .accordion-section -->
					<?php 
                }
            }
        }
    }
    ?>
		</ul><!-- .outer-border -->
	</div><!-- .accordion-container -->
	<?php 
    return $i;
}

WordPress Version: 4.6

/**
 * Meta Box Accordion Template Function
 *
 * Largely made up of abstracted code from do_meta_boxes(), this
 * function serves to build meta boxes as list items for display as
 * a collapsible accordion.
 *
 * @since 3.6.0
 *
 * @uses global $wp_meta_boxes Used to retrieve registered meta boxes.
 *
 * @param string|object $screen  The screen identifier.
 * @param string        $context The meta box context.
 * @param mixed         $object  gets passed to the section callback function as first parameter.
 * @return int number of meta boxes as accordion sections.
 */
function do_accordion_sections($screen, $context, $object)
{
    global $wp_meta_boxes;
    wp_enqueue_script('accordion');
    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);
    ?>
	<div id="side-sortables" class="accordion-container">
		<ul class="outer-border">
	<?php 
    $i = 0;
    $first_open = false;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ($wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $i++;
                    $hidden_class = in_array($box['id'], $hidden) ? 'hide-if-js' : '';
                    $open_class = '';
                    if (!$first_open && empty($hidden_class)) {
                        $first_open = true;
                        $open_class = 'open';
                    }
                    ?>
					<li class="control-section accordion-section <?php 
                    echo $hidden_class;
                    ?> <?php 
                    echo $open_class;
                    ?> <?php 
                    echo esc_attr($box['id']);
                    ?>" id="<?php 
                    echo esc_attr($box['id']);
                    ?>">
						<h3 class="accordion-section-title hndle" tabindex="0">
							<?php 
                    echo esc_html($box['title']);
                    ?>
							<span class="screen-reader-text"><?php 
                    _e('Press return or enter to open this section');
                    ?></span>
						</h3>
						<div class="accordion-section-content <?php 
                    postbox_classes($box['id'], $page);
                    ?>">
							<div class="inside">
								<?php 
                    call_user_func($box['callback'], $object, $box);
                    ?>
							</div><!-- .inside -->
						</div><!-- .accordion-section-content -->
					</li><!-- .accordion-section -->
					<?php 
                }
            }
        }
    }
    ?>
		</ul><!-- .outer-border -->
	</div><!-- .accordion-container -->
	<?php 
    return $i;
}

WordPress Version: 4.4

/**
 * Meta Box Accordion Template Function
 *
 * Largely made up of abstracted code from {@link do_meta_boxes()}, this
 * function serves to build meta boxes as list items for display as
 * a collapsible accordion.
 *
 * @since 3.6.0
 *
 * @uses global $wp_meta_boxes Used to retrieve registered meta boxes.
 *
 * @param string|object $screen  The screen identifier.
 * @param string        $context The meta box context.
 * @param mixed         $object  gets passed to the section callback function as first parameter.
 * @return int number of meta boxes as accordion sections.
 */
function do_accordion_sections($screen, $context, $object)
{
    global $wp_meta_boxes;
    wp_enqueue_script('accordion');
    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);
    ?>
	<div id="side-sortables" class="accordion-container">
		<ul class="outer-border">
	<?php 
    $i = 0;
    $first_open = false;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ($wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $i++;
                    $hidden_class = in_array($box['id'], $hidden) ? 'hide-if-js' : '';
                    $open_class = '';
                    if (!$first_open && empty($hidden_class)) {
                        $first_open = true;
                        $open_class = 'open';
                    }
                    ?>
					<li class="control-section accordion-section <?php 
                    echo $hidden_class;
                    ?> <?php 
                    echo $open_class;
                    ?> <?php 
                    echo esc_attr($box['id']);
                    ?>" id="<?php 
                    echo esc_attr($box['id']);
                    ?>">
						<h3 class="accordion-section-title hndle" tabindex="0">
							<?php 
                    echo esc_html($box['title']);
                    ?>
							<span class="screen-reader-text"><?php 
                    _e('Press return or enter to open this section');
                    ?></span>
						</h3>
						<div class="accordion-section-content <?php 
                    postbox_classes($box['id'], $page);
                    ?>">
							<div class="inside">
								<?php 
                    call_user_func($box['callback'], $object, $box);
                    ?>
							</div><!-- .inside -->
						</div><!-- .accordion-section-content -->
					</li><!-- .accordion-section -->
					<?php 
                }
            }
        }
    }
    ?>
		</ul><!-- .outer-border -->
	</div><!-- .accordion-container -->
	<?php 
    return $i;
}

WordPress Version: 4.3

/**
 * Meta Box Accordion Template Function
 *
 * Largely made up of abstracted code from {@link do_meta_boxes()}, this
 * function serves to build meta boxes as list items for display as
 * a collapsible accordion.
 *
 * @since 3.6.0
 *
 * @uses global $wp_meta_boxes Used to retrieve registered meta boxes.
 *
 * @param string|object $screen  The screen identifier.
 * @param string        $context The meta box context.
 * @param mixed         $object  gets passed to the section callback function as first parameter.
 * @return int number of meta boxes as accordion sections.
 */
function do_accordion_sections($screen, $context, $object)
{
    global $wp_meta_boxes;
    wp_enqueue_script('accordion');
    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);
    ?>
	<div id="side-sortables" class="accordion-container">
		<ul class="outer-border">
	<?php 
    $i = 0;
    $first_open = false;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ($wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $i++;
                    $hidden_class = in_array($box['id'], $hidden) ? 'hide-if-js' : '';
                    $open_class = '';
                    if (!$first_open && empty($hidden_class)) {
                        $first_open = true;
                        $open_class = 'open';
                    }
                    ?>
					<li class="control-section accordion-section <?php 
                    echo $hidden_class;
                    ?> <?php 
                    echo $open_class;
                    ?> <?php 
                    echo esc_attr($box['id']);
                    ?>" id="<?php 
                    echo esc_attr($box['id']);
                    ?>">
						<h3 class="accordion-section-title hndle" tabindex="0">
							<?php 
                    echo esc_html($box['title']);
                    ?>
							<span class="screen-reader-text"><?php 
                    _e('Press return or enter to expand');
                    ?></span>
						</h3>
						<div class="accordion-section-content <?php 
                    postbox_classes($box['id'], $page);
                    ?>">
							<div class="inside">
								<?php 
                    call_user_func($box['callback'], $object, $box);
                    ?>
							</div><!-- .inside -->
						</div><!-- .accordion-section-content -->
					</li><!-- .accordion-section -->
					<?php 
                }
            }
        }
    }
    ?>
		</ul><!-- .outer-border -->
	</div><!-- .accordion-container -->
	<?php 
    return $i;
}

WordPress Version: 4.1

/**
 * Meta Box Accordion Template Function
 *
 * Largely made up of abstracted code from {@link do_meta_boxes()}, this
 * function serves to build meta boxes as list items for display as
 * a collapsible accordion.
 *
 * @since 3.6.0
 *
 * @uses global $wp_meta_boxes Used to retrieve registered meta boxes.
 *
 * @param string|object $screen The screen identifier.
 * @param string $context The meta box context.
 * @param mixed $object gets passed to the section callback function as first parameter.
 * @return int number of meta boxes as accordion sections.
 */
function do_accordion_sections($screen, $context, $object)
{
    global $wp_meta_boxes;
    wp_enqueue_script('accordion');
    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);
    ?>
	<div id="side-sortables" class="accordion-container">
		<ul class="outer-border">
	<?php 
    $i = 0;
    $first_open = false;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ($wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $i++;
                    $hidden_class = in_array($box['id'], $hidden) ? 'hide-if-js' : '';
                    $open_class = '';
                    if (!$first_open && empty($hidden_class)) {
                        $first_open = true;
                        $open_class = 'open';
                    }
                    ?>
					<li class="control-section accordion-section <?php 
                    echo $hidden_class;
                    ?> <?php 
                    echo $open_class;
                    ?> <?php 
                    echo esc_attr($box['id']);
                    ?>" id="<?php 
                    echo esc_attr($box['id']);
                    ?>">
						<h3 class="accordion-section-title hndle" tabindex="0">
							<?php 
                    echo esc_html($box['title']);
                    ?>
							<span class="screen-reader-text"><?php 
                    _e('Press return or enter to expand');
                    ?></span>
						</h3>
						<div class="accordion-section-content <?php 
                    postbox_classes($box['id'], $page);
                    ?>">
							<div class="inside">
								<?php 
                    call_user_func($box['callback'], $object, $box);
                    ?>
							</div><!-- .inside -->
						</div><!-- .accordion-section-content -->
					</li><!-- .accordion-section -->
					<?php 
                }
            }
        }
    }
    ?>
		</ul><!-- .outer-border -->
	</div><!-- .accordion-container -->
	<?php 
    return $i;
}

WordPress Version: 4.0

/**
 * Meta Box Accordion Template Function
 *
 * Largely made up of abstracted code from {@link do_meta_boxes()}, this
 * function serves to build meta boxes as list items for display as
 * a collapsible accordion.
 *
 * @since 3.6.0
 *
 * @uses global $wp_meta_boxes Used to retrieve registered meta boxes.
 *
 * @param string|object $screen The screen identifier.
 * @param string $context The meta box context.
 * @param mixed $object gets passed to the section callback function as first parameter.
 * @return int number of meta boxes as accordion sections.
 */
function do_accordion_sections($screen, $context, $object)
{
    global $wp_meta_boxes;
    wp_enqueue_script('accordion');
    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);
    ?>
	<div id="side-sortables" class="accordion-container">
		<ul class="outer-border">
	<?php 
    $i = 0;
    $first_open = false;
    do {
        if (!isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context])) {
            break;
        }
        foreach (array('high', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ($wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $i++;
                    $hidden_class = in_array($box['id'], $hidden) ? 'hide-if-js' : '';
                    $open_class = '';
                    if (!$first_open && empty($hidden_class)) {
                        $first_open = true;
                        $open_class = 'open';
                    }
                    ?>
					<li class="control-section accordion-section <?php 
                    echo $hidden_class;
                    ?> <?php 
                    echo $open_class;
                    ?> <?php 
                    echo esc_attr($box['id']);
                    ?>" id="<?php 
                    echo esc_attr($box['id']);
                    ?>">
						<h3 class="accordion-section-title hndle" tabindex="0">
							<?php 
                    echo esc_html($box['title']);
                    ?>
							<span class="screen-reader-text"><?php 
                    _e('Press return or enter to expand');
                    ?></span>
						</h3>
						<div class="accordion-section-content <?php 
                    postbox_classes($box['id'], $page);
                    ?>">
							<div class="inside">
								<?php 
                    call_user_func($box['callback'], $object, $box);
                    ?>
							</div><!-- .inside -->
						</div><!-- .accordion-section-content -->
					</li><!-- .accordion-section -->
					<?php 
                }
            }
        }
    } while (0);
    ?>
		</ul><!-- .outer-border -->
	</div><!-- .accordion-container -->
	<?php 
    return $i;
}

WordPress Version: 3.7

/**
 * Meta Box Accordion Template Function
 *
 * Largely made up of abstracted code from {@link do_meta_boxes()}, this
 * function serves to build meta boxes as list items for display as
 * a collapsible accordion.
 *
 * @since 3.6.0
 *
 * @uses global $wp_meta_boxes Used to retrieve registered meta boxes.
 *
 * @param string|object $screen The screen identifier.
 * @param string $context The meta box context.
 * @param mixed $object gets passed to the section callback function as first parameter.
 * @return int number of meta boxes as accordion sections.
 */
function do_accordion_sections($screen, $context, $object)
{
    global $wp_meta_boxes;
    wp_enqueue_script('accordion');
    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);
    ?>
	<div id="side-sortables" class="accordion-container">
		<ul class="outer-border">
	<?php 
    $i = 0;
    $first_open = false;
    do {
        if (!isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context])) {
            break;
        }
        foreach (array('high', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ($wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $i++;
                    $hidden_class = in_array($box['id'], $hidden) ? 'hide-if-js' : '';
                    $open_class = '';
                    if (!$first_open && empty($hidden_class)) {
                        $first_open = true;
                        $open_class = 'open';
                    }
                    ?>
					<li class="control-section accordion-section <?php 
                    echo $hidden_class;
                    ?> <?php 
                    echo $open_class;
                    ?> <?php 
                    echo esc_attr($box['id']);
                    ?>" id="<?php 
                    echo esc_attr($box['id']);
                    ?>">
						<h3 class="accordion-section-title hndle" tabindex="0" title="<?php 
                    echo esc_attr($box['title']);
                    ?>"><?php 
                    echo esc_html($box['title']);
                    ?></h3>
						<div class="accordion-section-content <?php 
                    postbox_classes($box['id'], $page);
                    ?>">
							<div class="inside">
								<?php 
                    call_user_func($box['callback'], $object, $box);
                    ?>
							</div><!-- .inside -->
						</div><!-- .accordion-section-content -->
					</li><!-- .accordion-section -->
					<?php 
                }
            }
        }
    } while (0);
    ?>
		</ul><!-- .outer-border -->
	</div><!-- .accordion-container -->
	<?php 
    return $i;
}