Пример #1
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('title' => '', 'title_heading' => 'h2', 'title_alignment' => 'center', 'images' => '', 'image_size' => 'medium');
     // Use our instance args if they are there, otherwise use the defaults.
     $instance = wp_parse_args($instance, $defaults);
     $title = $instance['title'];
     $title_heading = $instance['title_heading'];
     $title_alignment = $instance['title_alignment'];
     $images = $instance['images'];
     $image_size = $instance['image_size'];
     $classname = $this->options['classname'];
     $image_sizes = mm_get_image_sizes('mm-logo-strip');
     $heading_levels = mm_get_heading_levels('mm-logo-strip');
     // Title.
     $this->field_text(__('Title', 'mm-components'), '', $classname . '-title widefat', 'title', $title);
     // Title heading.
     $this->field_select(__('Title Heading Level', 'mm-components'), '', $classname . '-title-heading widefat', 'title_heading', $title_heading, $heading_levels);
     // Title alignment.
     $this->field_select(__('Title Alignment', 'mm-components'), '', $classname . '-title-alignment widefat', 'title_alignment', $title_alignment, array('left' => __('Left', 'mm-components'), 'center' => __('Center', 'mm-components'), 'right' => __('Right', 'mm-components')));
     // Images.
     $this->field_multi_media(__('Images', 'mm-components'), '', $classname . '-images widefat', 'images', $images);
     // Image size.
     $this->field_select(__('Image Size', 'mm-components'), '', $classname . '-image-size widefat', 'image_size', $image_size, $image_sizes);
 }
Пример #2
0
/**
 * Return an array of registered image sizes for use in a Visual Composer dropdown param.
 *
 * @since   1.0.0
 *
 * @param   string  $context  The context to pass to our filter.
 *
 * @return  array             The array of formatted image sizes.
 */
function mm_get_image_sizes_for_vc($context = '')
{
    // Add an empty first option.
    $empty_option = array(__('Default', 'mm-components') => '');
    return $empty_option + array_flip(mm_get_image_sizes($context));
}
Пример #3
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('title' => '', 'icon_type' => 'fontawesome', 'image_size' => 'thumbnail', 'alignment' => 'left', 'style' => 'icon-only', 'ghost' => '', 'color' => '', 'size' => 'normal-size', 'mm_custom_class' => '');
     $colors = mm_get_colors('mm-social-icons');
     // Add our brand colors option.
     $brand_colors = array('brand-colors' => __('Brand Colors', 'mm-components'));
     $colors = array_merge($colors, $brand_colors);
     $social_networks = mm_get_social_networks('mm-social-icons');
     foreach ($social_networks as $social_network => $social_network_label) {
         $defaults[$social_network . '_link'] = '';
         $defaults[$social_network . '_image'] = '';
     }
     // Use our instance args if they are there, otherwise use the defaults.
     $instance = wp_parse_args($instance, $defaults);
     $title = $instance['title'];
     $icon_type = $instance['icon_type'];
     $image_size = $instance['image_size'];
     $alignment = $instance['alignment'];
     $style = $instance['style'];
     $ghost = $instance['ghost'];
     $color = $instance['color'];
     $size = $instance['size'];
     $classname = $this->options['classname'];
     // Title.
     $this->field_text(__('Title', 'mm-components'), '', $classname . '-title widefat', 'title', $title);
     // Icon Type.
     $this->field_select(__('Icon Type', 'mm-components'), '', $classname . '-icon-type widefat', 'icon_type', $icon_type, mm_get_social_icons_types('mm-social-icons'));
     // Image Size.
     $this->field_select(__('Image Size', 'mm-components'), '', $classname . '-image-size widefat', 'image_size', $image_size, mm_get_image_sizes('mm-social-icons'));
     // Icon Alignment.
     $this->field_select(__('Icon Alignment', 'mm-components'), '', $classname . '-alignment widefat', 'alignment', $alignment, mm_get_text_alignment('mm-social-icons'));
     // Icon Style.
     $this->field_select(__('Icon Style', 'mm-components'), '', $classname . '-style widefat', 'style', $style, mm_get_icon_styles('mm-social-icons'));
     // Ghost Mode.
     $this->field_multi_checkbox(__('Ghost Mode', 'mm-components'), '', $classname . '-ghost-mode widefat', 'ghost', $ghost, array('yes' => __('Yes', 'mm-components')));
     // Icon size.
     $this->field_select(__('Icon Size', 'mm-components'), '', $classname . '-size widefat', 'size', $size, array('' => __('Normal', 'mm-components'), 'small' => __('Small', 'mm-components'), 'large' => __('Large', 'mm-components')));
     // Icon color.
     $this->field_select(__('Icon Color', 'mm-components'), '', $classname . '-color widefat', 'color', $color, $colors);
     foreach ($social_networks as $social_network => $social_network_label) {
         // Social Network Link.
         $this->field_text(__($social_network_label . ' URL', 'mm-components'), '', $classname . '-social-network-link widefat', $social_network . '_link', $instance[$social_network . '_link']);
         // Social Network Image.
         $this->field_single_media(__($social_network_label . ' Image', 'mm-components'), '', $classname . '-social-network-image widefat', $social_network . '_image', $instance[$social_network . '_image']);
     }
 }
Пример #4
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'));
 }
Пример #5
0
/**
 * Register UI for Shortcake.
 *
 * @since  1.0.0
*/
function mm_components_mm_posts_shortcode_ui()
{
    if (!function_exists('shortcode_ui_register_for_shortcode')) {
        return;
    }
    $post_types = mm_get_post_types('mm-posts');
    $image_sizes = mm_get_image_sizes('mm-posts');
    $taxonomies = mm_get_taxonomies('mm-posts');
    $templates = mm_get_mm_posts_templates('mm-posts');
    shortcode_ui_register_for_shortcode('mm_posts', array('label' => esc_html__('Mm Posts', 'mm-components'), 'listItemImage' => MM_COMPONENTS_ASSETS_URL . 'component-icon.png', 'attrs' => array(array('label' => esc_html('Post ID', 'mm-components'), 'description' => esc_html__('Enter a post ID to display a single post', 'mm-components'), 'attr' => 'post_id', 'type' => 'text'), array('label' => esc_html__('Post Type', 'mm-components'), 'description' => esc_html__('Select a post type to display multiple posts', 'mm-components'), 'attr' => 'post_type', 'type' => 'select', 'options' => $post_types), array('label' => esc_html__('Taxonomy', 'mm-components'), 'description' => esc_html__('Select a taxonomy and term to only include posts that have the term', 'mm-components'), 'attr' => 'taxonomy', 'type' => 'select', 'options' => $taxonomies), array('label' => esc_html__('Term', 'mm-components'), 'description' => esc_html__('Specify a term in the selected taxonomy to only include posts that have the term', 'mm-components'), 'attr' => 'term', 'type' => 'text'), array('label' => esc_html__('Posts Per Page', 'mm-components'), 'description' => esc_html__('Specify the maximum number of posts to show at once', 'mm-components'), 'value' => '10', 'attr' => 'per_page', 'type' => 'text'), array('label' => esc_html__('Pagination', 'mm-components'), 'attr' => 'pagination', 'type' => 'select', 'options' => array('' => esc_html__('None', 'mm-components'), 'next-prev' => esc_html__('Next/Prev', 'mm-components'), 'page-numbers' => esc_html__('Page Numbers', 'mm-components'))), array('label' => esc_html__('Template', 'mm-components'), 'description' => esc_html__('Select a custom template for custom output', 'mm-components'), 'attr' => 'template', 'type' => 'select', 'options' => $templates), array('label' => esc_html__('Use Masonry?', 'mm-button'), 'attr' => 'masonry', 'type' => 'checkbox'), array('label' => esc_html__('Show the Featured Image?', 'mm-button'), 'attr' => 'show_featured_image', 'type' => 'checkbox'), array('label' => esc_html__('Featured Image Size', 'mm-components'), 'attr' => 'featured_image_size', 'type' => 'select', 'options' => $image_sizes), array('label' => esc_html__('Show post info?', 'mm-button'), 'description' => esc_html__('Default post info output includes post date and author.', 'mm-components'), 'attr' => 'show_post_info', 'type' => 'checkbox'), array('label' => esc_html__('Show post meta?', 'mm-button'), 'description' => esc_html__('Default post meta output includes category and tag links.', 'mm-components'), 'attr' => 'show_post_meta', 'type' => 'checkbox'), array('label' => esc_html__('Use full post content?', 'mm-button'), 'description' => esc_html__('By default the excerpt will be used. Check this to output the full post content.', 'mm-components'), 'attr' => 'use_post_content', 'type' => 'checkbox'))));
}