_Beans_Options::page PHP Method

page() public method

Page content.
public page ( $page )
    public function page($page)
    {
        global $wp_meta_boxes;
        if (!($boxes = beans_get($page, $wp_meta_boxes))) {
            return;
        }
        // Only add column class if there is more than 1 metaboxes.
        $column_class = beans_get('column', $boxes, array()) ? ' column' : false;
        // Set page data which will be used by the postbox.
        ?>
		<form action="" method="post" class="bs-options" data-page="<?php 
        echo esc_attr(beans_get('page'));
        ?>
">
			<?php 
        wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
        ?>
			<?php 
        wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
        ?>
			<input type="hidden" name="beans_options_nonce" value="<?php 
        echo esc_attr(wp_create_nonce('beans_options_nonce'));
        ?>
" />
			<div class="metabox-holder<?php 
        echo esc_attr($column_class);
        ?>
">
				<?php 
        do_meta_boxes($page, 'normal', null);
        if ($column_class) {
            do_meta_boxes($page, 'column', null);
        }
        ?>
			</div>
			<p class="bs-options-form-actions">
				<input type="submit" name="beans_save_options" value="<?php 
        echo esc_attr__('Save', 'tm-beans');
        ?>
" class="button-primary">
				<input type="submit" name="beans_reset_options" value="<?php 
        echo esc_attr__('Reset', 'tm-beans');
        ?>
" class="button-secondary">
			</p>
		</form>
		<?php 
    }

Usage Example

Exemplo n.º 1
0
/**
 * Echo the registered options.
 *
 * This function echos the options registered for the defined admin page.
 *
 * @since 1.0.0
 *
 * @param array $menu_slug The menu slug used to register the options.
 */
function beans_options($menu_slug)
{
    if (!class_exists('_Beans_Options')) {
        return false;
    }
    $class = new _Beans_Options();
    $class->page($menu_slug);
}