Пример #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))));
}
Пример #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');
}
Пример #3
0
/**
 * Visual Composer add-on.
 *
 * @since  1.0.0
 */
function mm_vc_social_icons()
{
    $social_icons_types = mm_get_social_icons_types_for_vc('mm-social-icons');
    $icon_styles = mm_get_icon_styles_for_vc('mm-social-icons');
    $image_sizes = mm_get_image_sizes_for_vc('mm-social-icons');
    $text_alignment = mm_get_text_alignment_for_vc('mm-social-icons');
    $colors = mm_get_colors_for_vc('mm-social-icons');
    $social_networks = mm_get_social_networks_for_vc('mm-social-icons');
    // Add our brand colors option.
    $brand_colors = array(__('Brand Colors', 'mm-components') => 'brand-colors');
    $colors = array_merge($colors, $brand_colors);
    vc_map(array('name' => __('Social Icons', 'mm-components'), 'base' => 'mm_social_icons', 'icon' => MM_COMPONENTS_ASSETS_URL . 'component-icon.png', 'category' => __('Content', 'mm-components'), 'params' => array(array('type' => 'dropdown', 'heading' => __('Icon Type', 'mm-components'), 'param_name' => 'icon_type', 'value' => $social_icons_types), array('type' => 'dropdown', 'heading' => __('Image Size', 'mm-components'), 'param_name' => 'image_size', 'value' => $image_sizes, 'dependency' => array('element' => 'icon_type', 'value' => 'images')), array('type' => 'dropdown', 'heading' => __('Icon Alignment', 'mm-components'), 'param_name' => 'alignment', 'value' => $text_alignment), array('type' => 'dropdown', 'heading' => __('Icon Style', 'mm-components'), 'param_name' => 'style', 'value' => $icon_styles, 'dependency' => array('element' => 'icon_type', 'value' => 'fontawesome')), array('type' => 'checkbox', 'heading' => __('Ghost Mode?', 'mm-components'), 'param_name' => 'ghost', 'description' => __('Colored icon and icon border with a transparent background', 'mm-components'), 'value' => array(__('Yes') => 1), 'dependency' => array('element' => 'style', 'value' => array('circle', 'square', 'rounded-square'))), array('type' => 'dropdown', 'heading' => __('Icon Color', 'mm-components'), 'param_name' => 'color', 'value' => $colors, 'dependency' => array('element' => 'icon_type', 'value' => 'fontawesome')), array('type' => 'dropdown', 'heading' => __('Icon Size', 'mm-components'), 'param_name' => 'size', 'value' => array(__('Normal', 'mm-components') => '', __('Small', 'mm-components') => 'small', __('Large', 'mm-components') => 'large')))));
    $social_network_params = array();
    foreach ($social_networks as $social_network_label => $social_network) {
        $social_network_params[] = array('type' => 'textfield', 'heading' => $social_network_label . ' ' . __('Link', 'mm-components'), 'param_name' => $social_network . '_link', 'value' => '');
        $social_network_params[] = array('type' => 'attach_image', 'heading' => $social_network_label . ' ' . __('Image', 'mm-components'), 'param_name' => $social_network . '_image', 'dependency' => array('element' => 'icon_type', 'value' => 'images'));
    }
    vc_add_params('mm_social_icons', $social_network_params);
}
Пример #4
0
/**
 * Visual Composer add-on.
 *
 * @since  1.0.0
 */
function mm_vc_image_card()
{
    $text_alignments = mm_get_text_alignment_for_vc('mm-image-card');
    $image_card_styles = mm_get_image_card_styles_for_vc('mm-image-card');
    $image_sizes = mm_get_image_sizes_for_vc('mm-image-card');
    $image_text_colors = mm_get_colors_for_vc('mm-image-card');
    $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' => __('Image Card', 'mm-components'), 'base' => 'mm_image_card', 'icon' => MM_COMPONENTS_ASSETS_URL . 'component-icon.png', 'category' => __('Content', 'mm-components'), 'params' => array(array('type' => 'attach_image', 'heading' => __('Image Card Image', 'mm-components'), 'param_name' => 'image'), array('type' => 'dropdown', 'heading' => __('Image Card Style', 'mm-components'), 'param_name' => 'image_card_style', 'value' => $image_card_styles), array('type' => 'dropdown', 'heading' => __('Image Size', 'mm-components'), 'param_name' => 'image_size', 'value' => $image_sizes), array('type' => 'textfield', 'heading' => __('Image Text', 'mm-components'), 'param_name' => 'image_text', 'dependency' => array('element' => 'image_card_style', 'value' => 'text-inside')), array('type' => 'dropdown', 'heading' => __('Image Text Color', 'mm-components'), 'param_name' => 'image_text_color', 'value' => $image_text_colors, 'dependency' => array('element' => 'image_card_style', 'value' => 'text-inside')), array('type' => 'checkbox', 'heading' => __('Link Image?', 'mm-components'), 'param_name' => 'link_image'), array('type' => 'vc_link', 'heading' => __('Image Card URL', 'mm-components'), 'param_name' => 'link'), array('type' => 'dropdown', 'heading' => __('Content Alignment', 'mm-components'), 'param_name' => 'content_align', 'value' => $text_alignments), array('type' => 'textfield', 'heading' => __('Button Text', 'mm-components'), 'param_name' => 'button_text', 'dependency' => array('element' => 'image_card_style', 'value' => 'button-bottom')), array('type' => 'dropdown', 'heading' => __('Button Style', 'mm-components'), 'param_name' => 'button_style', 'value' => $button_styles, 'dependency' => array('element' => 'image_card_style', 'value' => 'button-bottom')), 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 Color', 'mm-components'), 'param_name' => 'button_color', 'value' => $button_colors, 'dependency' => array('element' => 'image_card_style', 'value' => 'button')))));
}
Пример #5
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');
}