ID, '_wp_page_template', true ); /** * For now, we are registering the metabox only for the default and page with sidebar templates. * Any further templates with sidebar should be added there too */ $allowed_templates = array( 'default', 'page-templates/template-page-sidebar.php', ); $bp_pages = get_option( 'bp-pages' ); if ( ( in_array( $page_template, $allowed_templates ) || empty( $page_template ) ) && ( empty( $bp_pages ) || in_array( $post->ID, $bp_pages ) === false ) ) { add_meta_box( 'bigbang-individual-layout', esc_html__( 'Layout', 'bigbang' ), 'bigbang_individual_layout_metabox_content', array( 'post', 'page', ), 'side', 'low' ); } } } add_action( 'add_meta_boxes', 'bigbang_individual_layout_metabox' ); /** * The metabox content. * * @since 1.1.58 */ function bigbang_individual_layout_metabox_content() { // $post is already set, and contains an object: the WordPress post global $post; $values = get_post_custom( $post->ID ); $selected = isset( $values['bigbang_layout_select'] ) ? esc_attr( $values['bigbang_layout_select'][0] ) : ''; // We'll use this nonce field later on when saving. wp_nonce_field( 'bigbang_individual_layout_nonce', 'individual_layout_nonce' ); ?>