Beispiel #1
0
/**
 * Visual Composer add-on.
 *
 * @since  1.0.0
 */
function mm_vc_logo_strip()
{
    $image_sizes = mm_get_image_sizes_for_vc('mm-logo-strip');
    $heading_levels = mm_get_heading_levels_for_vc('mm-logo-strip');
    vc_map(array('name' => __('Logo Strip', 'mm-components'), 'base' => 'mm_logo_strip', 'class' => '', 'icon' => MM_COMPONENTS_ASSETS_URL . 'component-icon.png', 'category' => __('Content', 'mm-components'), 'params' => array(array('type' => 'textfield', 'heading' => __('Title', 'mm-components'), 'param_name' => 'title', 'admin_label' => true, 'value' => ''), array('type' => 'dropdown', 'heading' => __('Title Heading Level', 'mm-components'), 'param_name' => 'title_heading', 'value' => $heading_levels), array('type' => 'dropdown', 'heading' => __('Title Alignment', 'mm-components'), 'param_name' => 'title_alignment', 'value' => array(__('Center', 'mm-components') => 'center', __('Left', 'mm-components') => 'left', __('Right', 'mm-components') => 'right')), array('type' => 'attach_images', 'heading' => __('Logos', 'mm-components'), 'param_name' => 'images', 'description' => __('The bigger the image size, the better.', 'mm-components'), 'value' => ''), array('type' => 'dropdown', 'heading' => __('Logo Image Size', 'mm-components'), 'param_name' => 'image_size', 'value' => $image_sizes))));
}
Beispiel #2
0
/**
 * Visual Composer component.
 *
 * We're firing a bit late because we want to come after all
 * custom post types and taxonomies have been registered.
 *
 * @since  1.0.0
 */
function mm_vc_posts()
{
    // Only proceed if we're in the admin and Visual Composer is active.
    if (!is_admin()) {
        return;
    }
    if (!function_exists('vc_map')) {
        return;
    }
    $query_types = mm_get_query_types_for_vc('mm-posts');
    $titles = mm_get_post_titles_for_vc('mm-posts');
    $post_types = mm_get_post_types_for_vc('mm-posts');
    $taxonomies = mm_get_taxonomies_for_vc('mm-posts');
    $heading_levels = mm_get_heading_levels_for_vc('mm-posts');
    $image_sizes = mm_get_image_sizes_for_vc('mm-posts');
    $templates = mm_get_mm_posts_templates_for_vc('mm-posts');
    // Grab post type values with capital letters for description and title fields.
    $post_types_formatted = mm_get_post_types('mm-posts ');
    // Modify the array of post titles for better formatting.
    $last = array_slice($post_types_formatted, -1);
    $first = join(', ', array_slice($post_types_formatted, 0, -1));
    $both = array_filter(array_merge(array($first), $last), 'strlen');
    $formatted_titles = join(' or ', $both);
    $fomatted_plural_titles = str_replace(array(',', ' or'), array('s,', 's or'), trim($formatted_titles)) . 's';
    $title_heading = sprintf(__('Enter the Title(s) of Specific %s to Display', 'mm-components'), esc_html($fomatted_plural_titles));
    $title_description = sprintf(__('Enter a specific %s to display', 'mm-components'), esc_html($formatted_titles));
    vc_map(array('name' => __('Posts', 'mm-components'), 'base' => 'mm_posts', 'class' => '', 'icon' => MM_COMPONENTS_ASSETS_URL . 'component-icon.png', 'category' => __('Content', 'mm-components'), 'admin_enqueue_css' => MM_COMPONENTS_URL . '/css/post-titles-autocomplete.css', 'params' => array(array('type' => 'dropdown', 'heading' => __('Selection Type', 'mm-components'), 'param_name' => 'query_type', 'description' => __('Select posts by title or select posts of a specific type, taxonomy or term', 'mm-components'), 'value' => $query_types), array('type' => 'autocomplete', 'heading' => $title_heading, 'param_name' => 'post_ids', 'description' => $title_description, 'settings' => array('values' => $titles), 'dependency' => array('element' => 'query_type', 'value' => array('specific'))), array('type' => 'dropdown', 'heading' => __('Post Type', 'mm-components'), 'param_name' => 'post_type', 'description' => __('Select a post type to display multiple posts', 'mm-components'), 'value' => $post_types, 'dependency' => array('element' => 'query_type', 'value' => array('collection'))), array('type' => 'dropdown', 'heading' => __('Taxonomy', 'mm-components'), 'param_name' => 'taxonomy', 'description' => __('Select a taxonomy and term to only include posts that have the term', 'mm-components'), 'value' => $taxonomies, 'dependency' => array('element' => 'query_type', 'value' => array('collection'))), array('type' => 'textfield', 'heading' => __('Term', 'mm-components'), 'param_name' => 'term', 'description' => __('Specify a term in the selected taxonomy to only include posts that have the term', 'mm-components'), 'value' => '', 'dependency' => array('element' => 'query_type', 'value' => array('collection'))), array('type' => 'dropdown', 'heading' => __('Heading Level', 'mm-components'), 'param_name' => 'heading_level', 'description' => __('Select the post title heading level', 'mm-components'), 'value' => $heading_levels), array('type' => 'textfield', 'heading' => __('Posts Per Page', 'mm-components'), 'param_name' => 'per_page', 'description' => __('Specify the maximum number of posts to show at once', 'mm-components'), 'value' => '10'), array('type' => 'dropdown', 'heading' => __('Pagination', 'mm-components'), 'param_name' => 'pagination', 'value' => array(__('None', 'mm-components') => '', __('Next/Prev', 'mm-components') => 'next-prev', __('Page Numbers', 'mm-components') => 'page-numbers')), array('type' => 'checkbox', 'heading' => __('Show the Featured Image?', 'mm-components'), 'param_name' => 'show_featured_image', 'value' => array(__('Yes', 'mm-components') => 1)), array('type' => 'dropdown', 'heading' => __('Featured Image Size', 'mm-components'), 'param_name' => 'featured_image_size', 'value' => $image_sizes, 'dependency' => array('element' => 'show_featured_image', 'not_empty' => true)), array('type' => 'dropdown', 'heading' => __('Template', 'mm-components'), 'param_name' => 'template', 'description' => __('Select a custom template for custom output', 'mm-components'), 'value' => $templates), array('type' => 'checkbox', 'heading' => __('Use Masonry?', 'mm-components'), 'param_name' => 'masonry', 'value' => array(__('Yes', 'mm-components') => 1)), array('type' => 'checkbox', 'heading' => __('Link Title?', 'mm-components'), 'param_name' => 'link_title', 'std' => 1, 'value' => array(__('Yes', 'mm-components') => 1)), array('type' => 'checkbox', 'heading' => __('Show post info?', 'mm-components'), 'param_name' => 'show_post_info', 'description' => __('Default post info output includes post date and author.', 'mm-components'), 'value' => array(__('Yes', 'mm-components') => 1)), array('type' => 'checkbox', 'heading' => __('Show post meta?', 'mm-components'), 'param_name' => 'show_post_meta', 'description' => __('Default post meta output includes category and tag links.', 'mm-components'), 'value' => array(__('Yes', 'mm-components') => 1)), array('type' => 'checkbox', 'heading' => __('Use full post content?', 'mm-components'), 'param_name' => 'use_post_content', 'description' => __('By default the excerpt will be used. Check this to output the full post content.', 'mm-components'), 'value' => array(__('Yes', 'mm-components') => 1)))));
    // Because this component is registered on init we will call a custom action here
    // so that any templates adding extra params have a better hook to add them on.
    do_action('mm_posts_register_extra_vc_params');
}
Beispiel #3
0
/**
 * Visual Composer component.
 *
 * We're firing a bit late because we want to come after all
 * custom post types and taxonomies have been registered.
 *
 * @since  1.0.0
 */
function mm_vc_posts()
{
    // Only proceed if we're in the admin and Visual Composer is active.
    if (!is_admin()) {
        return;
    }
    if (!function_exists('vc_map')) {
        return;
    }
    $post_types = mm_get_post_types_for_vc('mm-posts');
    $taxonomies = mm_get_taxonomies_for_vc('mm-posts');
    $heading_levels = mm_get_heading_levels_for_vc('mm-posts');
    $image_sizes = mm_get_image_sizes_for_vc('mm-posts');
    $templates = mm_get_mm_posts_templates_for_vc('mm-posts');
    vc_map(array('name' => __('Posts', 'mm-components'), 'base' => 'mm_posts', 'class' => '', 'icon' => MM_COMPONENTS_ASSETS_URL . 'component-icon.png', 'category' => __('Content', 'mm-components'), 'params' => array(array('type' => 'textfield', 'heading' => __('Post IDs', 'mm-components'), 'param_name' => 'post_ids', 'description' => __('Enter post IDs to display (separated by commas)', 'mm-components'), 'value' => ''), array('type' => 'dropdown', 'heading' => __('Post Type', 'mm-components'), 'param_name' => 'post_type', 'description' => __('Select a post type to display multiple posts', 'mm-components'), 'value' => $post_types), array('type' => 'dropdown', 'heading' => __('Taxonomy', 'mm-components'), 'param_name' => 'taxonomy', 'description' => __('Select a taxonomy and term to only include posts that have the term', 'mm-components'), 'value' => $taxonomies), array('type' => 'textfield', 'heading' => __('Term', 'mm-components'), 'param_name' => 'term', 'description' => __('Specify a term in the selected taxonomy to only include posts that have the term', 'mm-components'), 'value' => ''), array('type' => 'dropdown', 'heading' => __('Heading Level', 'mm-components'), 'param_name' => 'heading_level', 'description' => __('Select the post title heading level', 'mm-components'), 'value' => $heading_levels), array('type' => 'textfield', 'heading' => __('Posts Per Page', 'mm-components'), 'param_name' => 'per_page', 'description' => __('Specify the maximum number of posts to show at once', 'mm-components'), 'value' => '10'), array('type' => 'dropdown', 'heading' => __('Pagination', 'mm-components'), 'param_name' => 'pagination', 'value' => array(__('None', 'mm-components') => '', __('Next/Prev', 'mm-components') => 'next-prev', __('Page Numbers', 'mm-components') => 'page-numbers')), array('type' => 'checkbox', 'heading' => __('Show the Featured Image?', 'mm-components'), 'param_name' => 'show_featured_image', 'value' => array(__('Yes', 'mm-components') => 1)), array('type' => 'dropdown', 'heading' => __('Featured Image Size', 'mm-components'), 'param_name' => 'featured_image_size', 'value' => $image_sizes, 'dependency' => array('element' => 'show_featured_image', 'not_empty' => true)), array('type' => 'dropdown', 'heading' => __('Template', 'mm-components'), 'param_name' => 'template', 'description' => __('Select a custom template for custom output', 'mm-components'), 'value' => $templates), array('type' => 'checkbox', 'heading' => __('Use Masonry?', 'mm-components'), 'param_name' => 'masonry', 'value' => array(__('Yes', 'mm-components') => 1)), array('type' => 'checkbox', 'heading' => __('Link Title?', 'mm-components'), 'param_name' => 'link_title', 'std' => 1, 'value' => array(__('Yes', 'mm-components') => 1)), array('type' => 'checkbox', 'heading' => __('Show post info?', 'mm-components'), 'param_name' => 'show_post_info', 'description' => __('Default post info output includes post date and author.', 'mm-components'), 'value' => array(__('Yes', 'mm-components') => 1)), array('type' => 'checkbox', 'heading' => __('Show post meta?', 'mm-components'), 'param_name' => 'show_post_meta', 'description' => __('Default post meta output includes category and tag links.', 'mm-components'), 'value' => array(__('Yes', 'mm-components') => 1)), array('type' => 'checkbox', 'heading' => __('Use full post content?', 'mm-components'), 'param_name' => 'use_post_content', 'description' => __('By default the excerpt will be used. Check this to output the full post content.', 'mm-components'), 'value' => array(__('Yes', 'mm-components') => 1)))));
    // Because this component is registered on init we will call a custom action here
    // so that any templates adding extra params have a better hook to add them on.
    do_action('mm_posts_register_extra_vc_params');
}
/**
 * Visual Composer add-on.
 *
 * @since  1.0.0
 */
function mm_vc_custom_heading()
{
    $heading_levels = mm_get_heading_levels_for_vc('mm-custom-heading');
    $fonts = mm_get_fonts_for_vc('mm-custom-heading');
    $font_weights = mm_get_font_weights_for_vc('mm-custom-heading');
    $colors = mm_get_colors_for_vc('mm-custom-heading');
    $text_alignments = mm_get_text_alignment_for_vc('mm-custom-heading');
    vc_map(array('name' => __('Custom Heading', 'mm-components'), 'base' => 'mm_custom_heading', 'class' => '', 'icon' => MM_COMPONENTS_ASSETS_URL . 'component-icon.png', 'category' => __('Content', 'mm-components'), 'params' => array(array('type' => 'textfield', 'heading' => __('Heading Text', 'mm-components'), 'param_name' => 'heading_text', 'admin_label' => true, 'value' => ''), array('type' => 'dropdown', 'heading' => __('Heading Level', 'mm-components'), 'param_name' => 'heading', 'std' => 'h2', 'value' => $heading_levels), array('type' => 'dropdown', 'heading' => __('Font', 'mm-components'), 'param_name' => 'font_family', 'value' => $fonts), array('type' => 'textfield', 'heading' => __('Font Size', 'mm-components'), 'param_name' => 'size', 'value' => '', 'description' => __('Leave blank to use default heading size, or specify a number of pixels. Example: 16', 'mm-components')), array('type' => 'dropdown', 'heading' => __('Font Weight', 'mm-components'), 'param_name' => 'weight', 'value' => $font_weights), array('type' => 'dropdown', 'heading' => __('Text Transform', 'mm-components'), 'param_name' => 'text_transform', 'value' => array(__('None', 'mm-components ') => '', __('Uppercase', 'mm-components ') => 'uppercase')), array('type' => 'dropdown', 'heading' => __('Text Align', 'mm-components'), 'param_name' => 'alignment', 'value' => $text_alignments), array('type' => 'dropdown', 'heading' => __('Color', 'mm-components'), 'param_name' => 'color', 'value' => $colors), array('type' => 'textfield', 'heading' => __('Margin Bottom', 'mm-components'), 'param_name' => 'margin_bottom', 'value' => '', 'description' => __('Leave blank to use default margin, or specify a number of pixels. Example: 16', 'mm-components')), array('type' => 'vc_link', 'heading' => __('Heading Link', 'mm-components'), 'param_name' => 'link', 'value' => ''))));
}
/**
 * Visual Composer add-on.
 *
 * @since  1.0.0
 */
function mm_vc_hero_banner()
{
    $background_positions = mm_get_background_position_for_vc('mm-hero-banner');
    $overlay_colors = mm_get_overlay_colors_for_vc('mm-hero-banner');
    $overlay_opacity_values = mm_get_overlay_opacity_values_for_vc('mm-hero-banner');
    $text_colors = mm_get_colors_for_vc('mm-hero-banner');
    $heading_levels = mm_get_heading_levels_for_vc('mm-hero-banner');
    $text_alignments = mm_get_text_alignment_for_vc('mm-hero-banner');
    $button_styles = mm_get_button_styles_for_vc('mm-button');
    $button_border_weights = mm_get_button_border_weights_for_vc('mm-button');
    $button_corner_styles = mm_get_button_corner_styles_for_vc('mm-button');
    $button_colors = mm_get_colors_for_vc('mm-button');
    vc_map(array('name' => __('Hero Banner', 'mm-components'), 'base' => 'mm_hero_banner', 'icon' => MM_COMPONENTS_ASSETS_URL . 'component-icon.png', 'category' => __('Content', 'mm-components'), 'params' => array(array('type' => 'attach_image', 'heading' => __('Background Image', 'mm-components'), 'param_name' => 'background_image'), array('type' => 'dropdown', 'heading' => __('Background Position', 'mm-components'), 'param_name' => 'background_position', 'value' => $background_positions), array('type' => 'checkbox', 'heading' => __('Full Height', 'mm-components'), 'param_name' => 'full_height', 'description' => __('Check this to make the Hero Banner as tall as the window.', 'mm-components'), 'value' => array(__('Yes', 'mm-components') => 1)), array('type' => 'textfield', 'heading' => __('Minimum Height', 'mm-components'), 'param_name' => 'min_height', 'description' => __('Specify a number of pixels. Default is 360.', 'mm-components')), array('type' => 'dropdown', 'heading' => __('Overlay Color', 'mm-components'), 'param_name' => 'overlay_color', 'value' => $overlay_colors), array('type' => 'dropdown', 'heading' => __('Overlay Opacity', 'mm-components'), 'param_name' => 'overlay_opacity', 'value' => $overlay_opacity_values, 'dependency' => array('element' => 'overlay_color', 'not_empty' => true)), array('type' => 'dropdown', 'heading' => __('Text Color', 'mm-components'), 'param_name' => 'text_color', 'value' => $text_colors), array('type' => 'textfield', 'heading' => __('Heading Text', 'mm-components'), 'param_name' => 'heading_text', 'admin_label' => true), array('type' => 'dropdown', 'heading' => __('Heading Level', 'mm-components'), 'param_name' => 'heading_level', 'value' => $heading_levels), array('type' => 'textarea_html', 'heading' => __('Content', 'mm-components'), 'param_name' => 'content'), array('type' => 'dropdown', 'heading' => __('Content Alignment', 'mm-components'), 'param_name' => 'content_align', 'value' => $text_alignments), array('type' => 'vc_link', 'heading' => __('Button URL', 'mm-components'), 'param_name' => 'button_link'), array('type' => 'textfield', 'heading' => __('Button Text', 'mm-components'), 'param_name' => 'button_text'), array('type' => 'dropdown', 'heading' => __('Button Style', 'mm-components'), 'param_name' => 'button_style', 'value' => $button_styles), array('type' => 'dropdown', 'heading' => __('Button Border Weight', 'mm-components'), 'param_name' => 'button_border_weight', 'value' => $button_border_weights, 'dependency' => array('element' => 'button_style', 'value' => array('ghost', 'solid-to-ghost'))), array('type' => 'dropdown', 'heading' => __('Button Corner Style', 'mm-components'), 'param_name' => 'button_corner_style', 'value' => $button_corner_styles), array('type' => 'dropdown', 'heading' => __('Button Color', 'mm-components'), 'param_name' => 'button_color', 'value' => $button_colors), array('type' => 'textarea_raw_html', 'heading' => __('Secondary Content', 'mm-components'), 'param_name' => 'secondary_content', 'description' => __('Outputs below the main button. Can include HTML markup.', 'mm-components')))));
}