true ) ); $screen = get_current_screen(); $post_type = $screen->id; if ( in_array( $post_type, ( array ) $post_types ) ) { wp_enqueue_style( 'generate-layout-metabox', get_template_directory_uri() . '/css/admin/meta-box.css', array(), GENERATE_VERSION ); } } } add_action( 'add_meta_boxes', 'generate_register_layout_meta_box' ); /** * Generate the layout metabox * * @since 2.0 */ function generate_register_layout_meta_box() { if ( ! current_user_can( apply_filters( 'generate_metabox_capability', 'edit_theme_options' ) ) ) { return; } if ( ! defined( 'GENERATE_LAYOUT_META_BOX' ) ) { define( 'GENERATE_LAYOUT_META_BOX', true ); } $post_types = get_post_types( array( 'public' => true ) ); foreach ($post_types as $type) { if ( 'attachment' !== $type ) { add_meta_box ( 'generate_layout_options_meta_box', esc_html__( 'Layout', 'generatepress' ), 'generate_do_layout_meta_box', $type, 'normal', 'high' ); } } } /** * Build our meta box. * * @since 2.0 * * @param object $post All post information. */ function generate_do_layout_meta_box( $post ) { wp_nonce_field( basename( __FILE__ ), 'generate_layout_nonce' ); $stored_meta = (array) get_post_meta( $post->ID ); $stored_meta['_generate-sidebar-layout-meta'][0] = ( isset( $stored_meta['_generate-sidebar-layout-meta'][0] ) ) ? $stored_meta['_generate-sidebar-layout-meta'][0] : ''; $stored_meta['_generate-footer-widget-meta'][0] = ( isset( $stored_meta['_generate-footer-widget-meta'][0] ) ) ? $stored_meta['_generate-footer-widget-meta'][0] : ''; $stored_meta['_generate-full-width-content'][0] = ( isset( $stored_meta['_generate-full-width-content'][0] ) ) ? $stored_meta['_generate-full-width-content'][0] : ''; $stored_meta['_generate-disable-headline'][0] = ( isset( $stored_meta['_generate-disable-headline'][0] ) ) ? $stored_meta['_generate-disable-headline'][0] : ''; $tabs = apply_filters( 'generate_metabox_tabs', array( 'sidebars' => array( 'title' => esc_html__( 'Sidebars', 'generatepress' ), 'target' => '#generate-layout-sidebars', 'class' => 'current', ), 'footer_widgets' => array( 'title' => esc_html__( 'Footer Widgets', 'generatepress' ), 'target' => '#generate-layout-footer-widgets', 'class' => '', ), 'disable_elements' => array( 'title' => esc_html__( 'Disable Elements', 'generatepress' ), 'target' => '#generate-layout-disable-elements', 'class' => '', ), 'container' => array( 'title' => esc_html__( 'Page Builder Container', 'generatepress' ), 'target' => '#generate-layout-page-builder-container', 'class' => '', ), ) ); ?>