The post creation screen is designed to let developers extend features by using custom meta boxes. In this scenario, we need a way to let the administrator upload files to a post. So, we need to define a custom meta box for displaying the input elements, as shown in the following code:
add_action( 'add_meta_boxes_post', 'wpqpa_post_attachments_meta_box' );function wpqpa_post_attachments_meta_box( $post ){ add_meta_box( 'wpqpa-post-attachments', __( 'Post attachments', 'wpqpa' ),'display_post_attachments_meta_box', 'post', 'normal', 'high' );}
The add_meta_boxes_post action is used to register a new meta box for normal posts. Inside this action, we can create a new meta box by using the add_meta_box function. ...