コード例 #1
0
ファイル: functions.php プロジェクト: jgonzo127/mm-components
/**
 * Return an array of image card styles for use in a Visual Composer param.
 *
 * @since   1.0.0
 *
 * @param   string  $context  The context to pass to our filter.
 *
 * @return  array             The array of image card styles.
 */
function mm_get_image_card_styles_for_vc($context = '')
{
    return array_flip(mm_get_image_card_styles($context));
}
コード例 #2
0
 /**
  * Output the Widget settings form.
  *
  * @since  1.0.0
  *
  * @param  array  $instance  The options for the widget instance.
  */
 public function form($instance)
 {
     $defaults = array('image' => '', 'image_card_style' => 'button-bottom', 'image_size' => '', 'image_text' => '', 'image_text_color' => '', 'link_image' => '', 'link' => '', 'link_target' => '_self', 'content_align' => 'default', 'button_link' => '', 'button_link_target' => '', 'button_text' => '', 'button_style' => '', 'button_border_weight' => 'default', 'button_corner_style' => '', 'button_color' => '');
     // Use our instance args if they are there, otherwise use the defaults.
     $instance = wp_parse_args($instance, $defaults);
     $image = $instance['image'];
     $image_card_style = $instance['image_card_style'];
     $image_size = $instance['image_size'];
     $image_text = $instance['image_text'];
     $image_text_color = $instance['image_text_color'];
     $link_image = $instance['link_image'];
     $link = $instance['link'];
     $link_target = $instance['link_target'];
     $content_align = $instance['content_align'];
     $button_link = $instance['button_link'];
     $button_link_target = $instance['button_link_target'];
     $button_text = $instance['button_text'];
     $button_style = $instance['button_style'];
     $button_border_weight = $instance['button_border_weight'];
     $button_corner_style = $instance['button_corner_style'];
     $button_color = $instance['button_color'];
     $classname = $this->options['classname'];
     // Image.
     $this->field_single_media(__('Image', 'mm-components'), __('Upload an image that is large enough to be output without stretching', 'mm-components'), $classname . '-image widefat', 'image', $image);
     // Image Card Style.
     $this->field_select(__('Image Card Style', 'mm-components'), '', $classname . '-image-card-style widefat', 'image_card_style', $image_card_style, mm_get_image_card_styles('mm-image-card'));
     // Link text.
     $this->field_text(__('Link', 'mm-components'), '', $classname . '-link widefat', 'link', $link);
     // Image Size.
     $this->field_select(__('Image Size', 'mm-components'), '', $classname . '-image-size widefat', 'image_size', $image_size, mm_get_image_sizes('mm-image-card'));
     // Image Text.
     $this->field_text(__('Image Text', 'mm-components'), '', $classname . '-image-text widefat', 'image_text', $image_text);
     // Image Text Color.
     $this->field_select(__('Image Text Color', 'mm-components'), '', $classname . '-image-text-color widefat', 'image_text_color', $image_text_color, mm_get_colors('mm-image-card'));
     // Link Image.
     $this->field_checkbox(__('Link Image?', 'mm-components'), '', $classname . '-link-image widefat', 'link_image', $link_image);
     // Link target.
     $this->field_select(__('Link Target', 'mm-components'), '', $classname . '-link-target widefat', 'button_link_target', $button_link_target, mm_get_link_targets('mm-button'));
     // Content align.
     $this->field_select(__('Content Alignment', 'mm-components'), '', $classname . '-content-align widefat', 'content_align', $content_align, mm_get_text_alignment('mm-image-card'));
     // Button text.
     $this->field_text(__('Button Text', 'mm-components'), '', $classname . '-button-text widefat', 'button_text', $button_text);
     // Button style.
     $this->field_select(__('Button Style', 'mm-components'), '', $classname . '-button-style widefat', 'button_style', $button_style, mm_get_button_styles('mm-button'));
     // Button border weight.
     $this->field_select(__('Button Border Weight', 'mm-components'), '', $classname . '-button-border-weight widefat', 'button_border_weight', $button_border_weight, mm_get_button_border_weights('mm-button'));
     // Button color.
     $this->field_select(__('Button Color', 'mm-components'), '', $classname . '-button-color widefat', 'button_color', $button_color, mm_get_colors('mm-button'));
 }