Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * The template file for post thumbnail. Modified to change the field type from `image` to `single_image`.
- *
- * @package Meta Box
- * @subpackage MB Frontend Submission
- */
- $default = array();
- $thumbnail_id = $data->post_id ? get_post_thumbnail_id( $data->post_id ) : '';
- $name = ! empty( $data->config['label_thumbnail'] ) ? $data->config['label_thumbnail'] : esc_html__( 'Thumbnail', 'rwmb-frontend-submission' );
- if ( $thumbnail_id ) {
- $default = array( $thumbnail_id );
- }
- $field = apply_filters(
- 'rwmb_frontend_post_thumbnail',
- array(
- 'type' => 'single_image',
- 'name' => $name,
- 'id' => '_thumbnail_id',
- 'max_file_uploads' => 1,
- 'std' => $default,
- )
- );
- $field = RWMB_Field::call( 'normalize', $field );
- RWMB_Field::call( $field, 'add_actions' );
- RWMB_Field::call( $field, 'admin_enqueue_scripts' );
- RWMB_Field::call( 'show', $field, false, $data->post_id );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement