$val ) { $allowed[] = $post_type; } if ( ! in_array($typenow, $allowed ) ) { return; } $screens = $allowed; foreach ( $screens as $screen ) { add_meta_box( 'aqpanel_meta_box_featured', __( 'Featured', 'featured-admin-panel' ), array( $this, 'aqpanel_meta_box_featured_callback' ), $screen, 'side' ); } } /** * Featured meta box callback. */ public function aqpanel_meta_box_featured_callback( $post ){ $is_aqpanel_featured_post = get_post_meta( $post->ID, '_is_aqpanel_featured_post', true ); wp_nonce_field( plugin_basename( __FILE__ ), 'aqpanel_featured_metabox_nonce' ); ?>

$val ) { $allowed[] = $post_type; } if ( ! in_array( get_post_type( $post_id ), $allowed ) ) { return $post_id; } // Bail if we're doing an auto save if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return; // if our nonce isn't there, or we can't verify it, bail if ( ! isset( $_POST['aqpanel_featured_metabox_nonce'] ) || ! wp_verify_nonce( $_POST['aqpanel_featured_metabox_nonce'], plugin_basename( __FILE__ ) ) ) return $post_id; // if our current user can't edit this post, bail if( ! current_user_can( 'edit_post' , $post_id ) ) return $post_id; $featured_value = ''; if ( isset( $_POST['aqpanel_settings']['make_this_featured'] ) && 'yes' == $_POST['aqpanel_settings']['make_this_featured'] ) { $featured_value = 'yes'; } if ( 'yes' == $featured_value ) { update_post_meta( $post_id, '_is_aqpanel_featured_post', $featured_value ); } else{ delete_post_meta( $post_id, '_is_aqpanel_featured_post' ); } return $post_id; } } endif; if ( class_exists( 'Admin_Quick_Panel_Meta', false ) ) { return new Admin_Quick_Panel_Meta(); }