Advertisement
Guest User

Untitled

a guest
Nov 27th, 2019
955
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.96 KB | None | 0 0
  1. <?php
  2. /**
  3.  * The template file for post thumbnail. Modified to change the field type from `image` to `single_image`.
  4.  *
  5.  * @package    Meta Box
  6.  * @subpackage MB Frontend Submission
  7.  */
  8.  
  9. $default      = array();
  10. $thumbnail_id = $data->post_id ? get_post_thumbnail_id( $data->post_id ) : '';
  11. $name         = ! empty( $data->config['label_thumbnail'] ) ? $data->config['label_thumbnail'] : esc_html__( 'Thumbnail', 'rwmb-frontend-submission' );
  12. if ( $thumbnail_id ) {
  13.     $default = array( $thumbnail_id );
  14. }
  15. $field = apply_filters(
  16.     'rwmb_frontend_post_thumbnail',
  17.     array(
  18.         'type'             => 'single_image',
  19.         'name'             => $name,
  20.         'id'               => '_thumbnail_id',
  21.         'max_file_uploads' => 1,
  22.         'std'              => $default,
  23.     )
  24. );
  25. $field = RWMB_Field::call( 'normalize', $field );
  26. RWMB_Field::call( $field, 'add_actions' );
  27. RWMB_Field::call( $field, 'admin_enqueue_scripts' );
  28. RWMB_Field::call( 'show', $field, false, $data->post_id );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement