/**
  * Prints the box content.
  *
  * @since 1.0.0
  * @param object $post    Current post object.
  * @param array  $metabox
  */
 public function callback_metabox($post, $metabox)
 {
     if (!class_exists('Cherry_Interface_Builder')) {
         return;
     }
     // open core UI wrappers
     echo '<div class="cherry-ui-core">';
     // Add an nonce field so we can check for it later.
     wp_nonce_field(plugin_basename(__FILE__), 'cherry_team_options_meta_nonce');
     $builder = new Cherry_Interface_Builder(array('name_prefix' => CHERRY_TEAM_POSTMETA, 'pattern' => 'inline', 'class' => array('section' => 'single-section')));
     foreach ($metabox['args'] as $field) {
         // Check if set the 'id' value for custom field. If not - don't add field.
         if (!isset($field['id'])) {
             continue;
         }
         $field['value'] = Cherry_Team::get_meta($post->ID, $field['id'], $field['value']);
         echo $builder->add_form_item($field);
     }
     /**
      * Fires after testimonial fields of metabox.
      *
      * @since 1.0.0
      * @param object $post                 Current post object.
      * @param array  $metabox
      * @param string CHERRY_TEAM_POSTMETA Name for 'meta_key' value in the 'wp_postmeta' table.
      */
     do_action('cherry_team_metabox_after', $post, $metabox, CHERRY_TEAM_POSTMETA);
     // close core UI wrappers
     echo '</div>';
 }
 /**
  * Displays a meta box of radio selectors on the post editing screen, which allows theme users to select
  * the layout they wish to use for the specific post.
  *
  * @since  4.0.0
  * @param  object $post    The post object currently being edited.
  * @param  array  $metabox Specific information about the meta box being loaded.
  * @return void
  */
 public function callback_metabox($post, $metabox)
 {
     // Get the current post's layout.
     $post_layout = $this->get_post_layout($post->ID);
     $args = array('id' => 'layout', 'type' => 'radio', 'value' => $post_layout, 'display_input' => false, 'options' => $metabox['args']);
     wp_nonce_field(basename(__FILE__), 'cherry-layouts-nonce');
     $builder = new Cherry_Interface_Builder(array('name_prefix' => 'cherry', 'pattern' => 'inline', 'class' => array('section' => 'single-section')));
     printf('<div class="post-layout">%s</div>', $builder->add_form_item($args));
     /**
      * Fires after `Layouts` fields of metabox.
      *
      * @since 4.0.0
      * @param object $post
      * @param array  $metabox
      */
     do_action('cherry_layouts_metabox_after', $post, $metabox);
 }
 public function format_metabox_builder($post_id = null, $format = 'standart')
 {
     $output = '';
     $settings_field = $this->format_settings($format);
     foreach ($settings_field as $settings) {
         // Get current post meta data.
         $post_meta = get_post_meta($post_id, CHERRY_PORTFOLIO_POSTMETA, true);
         if (!empty($post_meta) && isset($post_meta[$settings['id']])) {
             $field_value = $post_meta[$settings['id']];
         } else {
             $field_value = $settings['value'];
         }
         $settings['value'] = $field_value;
         $builder = new Cherry_Interface_Builder(array('name_prefix' => CHERRY_PORTFOLIO_POSTMETA, 'pattern' => 'inline', 'class' => array('section' => 'single-section')));
         $output .= $builder->add_form_item($settings);
     }
     printf('<div class="%1$s cherry-ui-core">%2$s</div>', 'settings-item ' . $format . '-post-format-settings', $output);
 }
Exemplo n.º 4
0
 /**
  * Displays a meta box of radio selectors on the post editing screen, which allows theme users to select
  * the grid type they wish to use for the specific post.
  *
  * @since  4.0.0
  * @param  object $post    The post object currently being edited.
  * @param  array  $metabox Specific information about the meta box being loaded.
  * @return void
  */
 public function callback_metabox($post, $metabox)
 {
     // Get the current post's grid type.
     $post_grid_type = $this->get_post_grid_type($post->ID);
     wp_nonce_field(basename(__FILE__), 'cherry-grid-type-nonce');
     $builder = new Cherry_Interface_Builder(array('name_prefix' => 'grid-type', 'pattern' => 'inline', 'class' => array('section' => 'single-section')));
     $builder->enqueue_builder_scripts();
     $builder->enqueue_builder_styles();
     $output = '';
     foreach ($this->options as $id => $item) {
         $args = array('id' => $id, 'type' => 'radio', 'value' => $post_grid_type[$id], 'display_input' => false, 'options' => $metabox['args'][$id]);
         $output .= sprintf('<div class="post-grid-type_col"><div class="post-grid-type_col__inner"><h4 class="cherry-title">%1$s</h4>%2$s</div></div>', $item['name'], $builder->add_form_item($args));
     }
     printf('<div class="post-grid-type_container"><div class="post-grid-type_row">%s</div><div class="clear"></div></div>', $output);
     /**
      * Fires after `Grid Type` fields of metabox.
      *
      * @since 4.0.0
      * @param object $post    The post object
      * @param array  $metabox Metabox information.
      */
     do_action('cherry_grid_type_metabox_after', $post, $metabox);
 }
 /**
  * Displays a meta box of radio selectors on the post editing screen, which allows theme users to select
  * the layout they wish to use for the specific post.
  *
  * @since  4.0.0
  * @param  object $post    The post object currently being edited.
  * @param  array  $metabox Specific information about the meta box being loaded.
  * @return void
  */
 public function callback_metabox($post, $metabox)
 {
     $bg_defaults = array('image' => '', 'color' => '', 'repeat' => '', 'position' => '', 'attachment' => '');
     // Get the current post header bg
     $header_bg = $this->get_post_style($post->ID, 'header-background', $bg_defaults);
     $fields = array(array('id' => 'header-background', 'title' => __('Header background', 'cherry'), 'type' => 'background', 'value' => $header_bg));
     $fields = apply_filters('cherry_post_style_metabox_fields', $fields);
     wp_nonce_field(basename(__FILE__), 'cherry-style-nonce');
     $builder = new Cherry_Interface_Builder(array('name_prefix' => 'cherry-style', 'pattern' => 'inline', 'class' => array('section' => 'single-section')));
     $content = '';
     foreach ($fields as $field) {
         $content .= $builder->add_form_item($field);
     }
     printf('<div class="cherry-ui-core post-style">%s</div>', $content);
     /**
      * Fires after `Style` fields of metabox.
      *
      * @since 4.0.0
      * @param object $post
      * @param array  $metabox
      */
     do_action('cherry_style_metabox_after', $post, $metabox);
 }