function grve_gmap_shortcode($atts, $content) { $output = $el_class = ''; extract(shortcode_atts(array('map_lat' => '51.516221', 'map_lng' => '-0.136986', 'map_height' => '280', 'map_marker' => '', 'map_zoom' => 14, 'margin_bottom' => '', 'el_class' => ''), $atts)); wp_enqueue_script('grve-googleapi-script'); wp_enqueue_script('grve-maps-script'); $gmap_classes = array('grve-element', 'grve-map'); if (!empty($el_class)) { array_push($gmap_classes, $el_class); } $gmap_class_string = implode(' ', $gmap_classes); $style = grve_osmosis_vce_build_margin_bottom_style($margin_bottom); if (empty($map_marker)) { $map_marker = get_template_directory_uri() . '/images/markers/markers.png'; } else { $id = preg_replace('/[^\\d]/', '', $map_marker); $full_src = wp_get_attachment_image_src($id, 'full'); $map_marker = $full_src[0]; } $map_title = ''; $data_map = 'data-lat="' . esc_attr($map_lat) . '" data-lng="' . esc_attr($map_lng) . '" data-zoom="' . esc_attr($map_zoom) . '"'; $output .= '<div class="grve-map-wrapper">'; $output .= ' <div style="display:none" class="grve-map-point" data-point-lat="' . esc_attr($map_lat) . '" data-point-lng="' . esc_attr($map_lng) . '" data-point-marker="' . esc_attr($map_marker) . '" data-point-title="' . esc_attr($map_title) . '"></div>'; $output .= ' <div class="' . esc_attr($gmap_class_string) . '" ' . $data_map . ' style="' . $style . grve_osmosis_vce_build_dimension('height', $map_height) . '"></div>'; $output .= '</div>'; return $output; }
function grve_pie_chart_shortcode($atts, $content) { $output = $link_start = $link_end = $retina_data = $data = $el_class = ''; extract(shortcode_atts(array('pie_chart_val' => '50', 'pie_chart_prefix' => '', 'pie_chart_suffix' => '', 'pie_chart_line_size' => '6', 'pie_chart_color' => '', 'pie_active_color' => '', 'pie_line_style' => 'square', 'title' => '', 'pie_chart_text' => '', 'animation' => '', 'animation_delay' => '200', 'margin_bottom' => '', 'el_class' => ''), $atts)); $pie_chart_classes = array('grve-element'); array_push($pie_chart_classes, 'grve-pie-chart'); if (!empty($animation)) { array_push($pie_chart_classes, 'grve-animated-item'); array_push($pie_chart_classes, $animation); $data = ' data-delay="' . esc_attr($animation_delay) . '"'; } if (!empty($el_class)) { array_push($pie_chart_classes, $el_class); } $pie_chart_class_string = implode(' ', $pie_chart_classes); $style = grve_osmosis_vce_build_margin_bottom_style($margin_bottom); $output .= '<div class="' . esc_attr($pie_chart_class_string) . '" style="' . $style . '"' . $data . '>'; $output .= ' <div class="grve-chart-number" data-percent="' . esc_attr($pie_chart_val) . '" data-pie-active-color="' . esc_attr($pie_active_color) . '" data-pie-color="' . esc_attr($pie_chart_color) . '" data-pie-line-cap="' . esc_attr($pie_line_style) . '" data-pie-line-size="' . esc_attr($pie_chart_line_size) . '">'; $output .= ' <span class="grve-counter">' . $pie_chart_prefix . $pie_chart_val . $pie_chart_suffix . '</span>'; $output .= ' </div>'; if (!empty($title)) { $output .= ' <h5 class="grve-chart-title">' . $title . '</h5>'; } if (!empty($pie_chart_text)) { $output .= ' <p>' . $pie_chart_text . '</p>'; } $output .= '</div>'; return $output; }
function grve_list_shortcode($atts, $content) { $el_class = ''; extract(shortcode_atts(array('title' => '', 'icon' => '', 'margin_bottom' => '', 'el_class' => ''), $atts)); $style = grve_osmosis_vce_build_margin_bottom_style($margin_bottom); $content = wpautop(preg_replace('/<\\/?p\\>/', "\n", $content) . "\n"); return '<div class="grve-element grve-list grve-list-' . esc_attr($icon) . ' ' . esc_attr($el_class) . '" style="' . $style . '">' . $content . '</div>'; }
function grve_divider_shortcode($atts, $content) { $output = $class_fullwidth = $style = $el_class = ''; extract(shortcode_atts(array('title' => '', 'line_type' => 'space', 'backtotop_title' => '', 'padding_top' => '', 'padding_bottom' => '', 'margin_bottom' => '', 'el_class' => ''), $atts)); $style .= grve_osmosis_vce_build_margin_bottom_style($margin_bottom); $style .= grve_osmosis_vce_build_padding_top_style($padding_top); $style .= grve_osmosis_vce_build_padding_bottom_style($padding_bottom); $output .= '<div class="grve-element grve-hr grve-' . $line_type . '-divider' . $el_class . '" style="' . $style . '">'; if (!empty($backtotop_title) && 'top-line' == $line_type) { $output .= ' <span class="grve-divider-backtotop">' . $backtotop_title . '</span>'; } $output .= '</div>'; return $output; }
function grve_progress_bar_shortcode($atts, $content) { $output = $style = $bar_height_style = $el_class = ''; extract(shortcode_atts(array('bar_style' => 'style-1', 'values' => '', 'bar_line_style' => 'square', 'bar_height' => '35', 'color' => 'primary', 'margin_bottom' => '', 'el_class' => ''), $atts)); $bars_classes = array('grve-element', 'grve-progress-bars'); array_push($bars_classes, 'grve-' . $bar_style); array_push($bars_classes, 'grve-line-' . $bar_line_style); $bars_class_string = implode(' ', $bars_classes); if (!empty($bar_height) && 'style-2' == $bar_style) { $bar_height_style .= 'height: ' . (preg_match('/(px|em|\\%|pt|cm)$/', $bar_height) ? $bar_height : $bar_height . 'px') . ';'; } $style .= grve_osmosis_vce_build_margin_bottom_style($margin_bottom); $graph_lines = explode(",", $values); $graph_lines_data = array(); foreach ($graph_lines as $line) { $new_line = array(); $data = explode("|", $line); $new_line['value'] = isset($data[0]) && !empty($data[0]) ? $data[0] : 0; $new_line['percentage_value'] = isset($data[1]) && !empty($data[1]) ? $data[1] : ''; $new_line['color'] = isset($data[2]) && !empty($data[2]) ? $data[2] : $color; if ((double) $new_line['value'] < 0) { $new_line['value'] = 0; } else { if ((double) $new_line['value'] > 100) { $new_line['value'] = 100; } } $new_line['label'] = $new_line['percentage_value']; $graph_lines_data[] = $new_line; } $output .= '<div class="' . esc_attr($bars_class_string) . '" style="' . $style . '">'; foreach ($graph_lines_data as $line) { $color_class = 'grve-primary'; if ('primary' != $line['color']) { $color_class = 'grve-bg-' . $line['color']; } $output .= '<div class="grve-element grve-progress-bar grve-margin-10" data-value="' . esc_attr($line['value']) . '">'; $output .= ' <div class="grve-bar-title">' . $line['label'] . '</div>'; $output .= ' <div class="grve-bar">'; $output .= ' <div class="grve-bar-line ' . esc_attr($color_class) . '" " style="' . $bar_height_style . '"></div>'; $output .= ' </div>'; $output .= '</div>'; } $output .= '</div>'; return $output; }
function grve_slogan_shortcode($atts, $content) { $output = $data = $el_class = $text_style_class = ''; extract(shortcode_atts(array('title' => '', 'heading' => 'h1', 'line_type' => 'no-line', 'subtitle' => '', 'button_text' => '', 'button_link' => '', 'button_type' => 'simple', 'button_size' => 'medium', 'button_color' => 'primary-1', 'button_shape' => 'square', 'button_class' => '', 'button2_text' => '', 'button2_link' => '', 'button2_type' => 'simple', 'button2_size' => 'medium', 'button2_color' => 'primary-1', 'button2_shape' => 'square', 'button2_class' => '', 'text_style' => 'none', 'align' => 'left', 'animation' => '', 'animation_delay' => '200', 'margin_bottom' => '', 'el_class' => ''), $atts)); //Title if (!empty($title)) { //Title Classes $title_classes = array('grve-slogan-title'); array_push($title_classes, 'grve-align-' . $align); array_push($title_classes, 'grve-title-' . $line_type); $title_class_string = implode(' ', $title_classes); } //Slogan $slogan_classes = array('grve-element', 'grve-slogan', 'grve-align-' . $align); if (!empty($animation)) { array_push($slogan_classes, 'grve-animated-item'); array_push($slogan_classes, $animation); $data = ' data-delay="' . esc_attr($animation_delay) . '"'; } if (!empty($el_class)) { array_push($slogan_classes, $el_class); } $slogan_class_string = implode(' ', $slogan_classes); // Paragraph if ('none' != $text_style) { $text_style_class = 'grve-' . $text_style; } //First Button $button1 = grve_osmosis_vce_get_button($button_text, $button_link, $button_type, $button_size, $button_color, $button_shape, $button_class); //Second Button $button2 = grve_osmosis_vce_get_button($button2_text, $button2_link, $button2_type, $button2_size, $button2_color, $button2_shape, $button2_class); $style = grve_osmosis_vce_build_margin_bottom_style($margin_bottom); $output .= '<div class="' . esc_attr($slogan_class_string) . '" style="' . $style . '"' . $data . '>'; if (!empty($subtitle)) { $output .= '<div class="grve-subtitle">' . $subtitle . '</div>'; } if (!empty($title)) { $output .= '<' . $heading . ' class="' . esc_attr($title_class_string) . '"><span>' . $title . '</span></' . $heading . '>'; } $output .= ' <p class="' . esc_attr($text_style_class) . '">' . $content . '</p>'; $output .= $button1; $output .= $button2; $output .= '</div>'; return $output; }
function grve_video_shortcode($atts, $content) { global $wp_embed; $output = $class_fullwidth = $el_class = ''; extract(shortcode_atts(array('video_link' => '', 'margin_bottom' => '', 'el_class' => ''), $atts)); $video_classes = array('grve-element', 'grve-video'); if (!empty($el_class)) { array_push($video_classes, $el_class); } $video_class_string = implode(' ', $video_classes); $style = grve_osmosis_vce_build_margin_bottom_style($margin_bottom); if (!empty($video_link)) { $output .= '<div class="' . esc_attr($video_class_string) . '" style="' . $style . '">'; $output .= $wp_embed->run_shortcode('[embed]' . $video_link . '[/embed]'); $output .= '</div>'; } return $output; }
function grve_pricing_table_shortcode($atts, $content) { $output = $data = $el_class = ''; extract(shortcode_atts(array('title' => '', 'price' => '', 'interval' => '', 'feature' => '', 'values' => '', 'button_text' => '', 'button_link' => '', 'button_type' => 'simple', 'button_size' => 'medium', 'button_color' => 'primary-1', 'button_shape' => 'square', 'button_class' => '', 'bg_color' => '', 'animation' => '', 'animation_delay' => '200', 'margin_bottom' => '', 'el_class' => ''), $atts)); $button = grve_osmosis_vce_get_button($button_text, $button_link, $button_type, $button_size, $button_color, $button_shape, $button_class); //Pricing Table Classes $pricing_classes = array('grve-element', 'grve-pricing-table'); if ('yes' == $feature) { array_push($pricing_classes, 'grve-pricing-feature'); } if (!empty($animation)) { array_push($pricing_classes, 'grve-animated-item'); array_push($pricing_classes, $animation); $data = ' data-delay="' . esc_attr($animation_delay) . '"'; } if (!empty($el_class)) { array_push($pricing_classes, $el_class); } $pricing_class_string = implode(' ', $pricing_classes); //Pricing Lines $pricing_lines = explode(",", $values); $pricing_lines_data = array(); foreach ($pricing_lines as $line) { $new_line = array(); $data_line = explode("|", $line); $new_line['value1'] = isset($data_line[0]) && !empty($data_line[0]) ? $data_line[0] : ''; $new_line['value2'] = isset($data_line[1]) && !empty($data_line[1]) ? $data_line[1] : ''; $pricing_lines_data[] = $new_line; } $style = grve_osmosis_vce_build_margin_bottom_style($margin_bottom); $output .= '<div class="' . $pricing_class_string . '" style="' . $style . '"' . $data . '>'; $output .= ' <div class="grve-pricing-header">'; $output .= ' <h6 class="grve-pricing-title">' . $title . '</h6>'; $output .= ' <h4 class="grve-price">' . $price . ' <span>' . $interval . '</span></h4>'; $output .= ' </div>'; $output .= ' <ul>'; foreach ($pricing_lines_data as $line) { $output .= '<li><strong>' . $line['value1'] . ' </strong>' . $line['value2'] . '</li>'; } $output .= ' </ul>'; $output .= $button; $output .= '</div>'; return $output; }
function grve_quote_shortcode($atts, $content) { $output = $data = $el_class = ''; extract(shortcode_atts(array('animation' => '', 'animation_delay' => '200', 'margin_bottom' => '', 'el_class' => ''), $atts)); $quote_classes = array('grve-element'); if (!empty($animation)) { array_push($quote_classes, 'grve-animated-item'); array_push($quote_classes, $animation); $data = ' data-delay="' . esc_attr($animation_delay) . '"'; } if (!empty($el_class)) { array_push($quote_classes, $el_class); } $quote_class_string = implode(' ', $quote_classes); $style = grve_osmosis_vce_build_margin_bottom_style($margin_bottom); $output .= '<blockquote class="' . esc_attr($quote_class_string) . '" style="' . $style . '"' . $data . '>'; $output .= '<p>' . $content . '</p>'; $output .= '</blockquote>'; return $output; }
function grve_title_shortcode($atts, $content) { $output = $data = $el_class = ''; extract(shortcode_atts(array('title' => '', 'heading' => 'h3', 'line_type' => 'no-line', 'align' => '', 'animation' => '', 'animation_delay' => '200', 'margin_bottom' => '', 'el_class' => ''), $atts)); $style = grve_osmosis_vce_build_margin_bottom_style($margin_bottom); $title_classes = array('grve-element'); array_push($title_classes, 'grve-align-' . $align); array_push($title_classes, 'grve-title-' . $line_type); if (!empty($animation)) { array_push($title_classes, 'grve-animated-item'); array_push($title_classes, $animation); $data = ' data-delay="' . esc_attr($animation_delay) . '"'; } if (!empty($el_class)) { array_push($title_classes, $el_class); } $title_class_string = implode(' ', $title_classes); $output .= '<' . $heading . ' class="' . esc_attr($title_class_string) . '" style="' . $style . '"' . $data . '><span>' . $title . '</span></' . $heading . '>'; return $output; }
function grve_counter_shortcode($atts, $content) { $output = $link_start = $link_end = $retina_data = $data = $el_class = ''; extract(shortcode_atts(array('counter_style' => 'style-1', 'counter_start_val' => '0', 'counter_end_val' => '100', 'counter_prefix' => '', 'counter_suffix' => '', 'counter_decimal_points' => '0', 'counter_decimal_separator' => '.', 'counter_color' => '', 'counter_thousands_separator_vis' => '', 'counter_thousands_separator' => ',', 'title' => '', 'icon' => '', 'icon_type' => '', 'icon_color' => '', 'animation' => '', 'animation_delay' => '200', 'margin_bottom' => '', 'el_class' => ''), $atts)); $counter_classes = array('grve-element'); array_push($counter_classes, 'grve-counter'); array_push($counter_classes, 'grve-align-center'); if ('style-2' == $counter_style) { array_push($counter_classes, 'grve-style-2'); } if (!empty($animation)) { array_push($counter_classes, 'grve-animated-item'); array_push($counter_classes, $animation); $data = ' data-delay="' . esc_attr($animation_delay) . '"'; } if (!empty($el_class)) { array_push($counter_classes, $el_class); } $counter_class_string = implode(' ', $counter_classes); $icon_classes = array('grve-icon'); if ('icon' == $icon_type) { array_push($icon_classes, 'fa fa-' . $icon); } $icon_class_string = implode(' ', $icon_classes); $style = grve_osmosis_vce_build_margin_bottom_style($margin_bottom); $output .= '<div class="' . esc_attr($counter_class_string) . '" style="' . $style . '"' . $data . '>'; if ('icon' == $icon_type) { $output .= ' <div class="' . esc_attr($icon_class_string) . ' grve-color-' . esc_attr($icon_color) . '"></div>'; } $output .= ' <div class="grve-counter-content">'; $output .= ' <div class="grve-counter-item grve-color-' . esc_attr($counter_color) . '">'; $output .= ' <span data-thousands-separator-vis="' . esc_attr($counter_thousands_separator_vis) . '" data-thousands-separator="' . esc_attr($counter_thousands_separator) . '" data-prefix="' . esc_attr($counter_prefix) . '" data-suffix="' . esc_attr($counter_suffix) . '" data-start-val="' . esc_attr($counter_start_val) . '" data-end-val="' . esc_attr($counter_end_val) . '" data-decimal-points="' . esc_attr($counter_decimal_points) . '" data-decimal-separator="' . esc_attr($counter_decimal_separator) . '">' . $counter_start_val . '</span>'; $output .= ' </div>'; $output .= ' <h5 class="grve-counter-title">' . $title . '</h5>'; $output .= ' </div>'; $output .= '</div>'; return $output; }
function grve_message_box_shortcode($atts, $content) { $output = $data = $el_class = ''; extract(shortcode_atts(array('icon' => '', 'bg_color' => 'green', 'animation' => '', 'animation_delay' => '200', 'margin_bottom' => '', 'el_class' => ''), $atts)); $message_box_classes = array('grve-element', 'grve-message'); array_push($message_box_classes, 'grve-bg-' . $bg_color); if (!empty($animation)) { array_push($message_box_classes, 'grve-animated-item'); array_push($message_box_classes, $animation); $data = ' data-delay="' . esc_attr($animation_delay) . '"'; } if (!empty($el_class)) { array_push($message_box_classes, $el_class); } $message_box_class_string = implode(' ', $message_box_classes); $style = grve_osmosis_vce_build_margin_bottom_style($margin_bottom); $output .= '<div class="' . esc_attr($message_box_class_string) . '" style="' . $style . '"' . $data . '>'; $output .= ' <i class="grve-icon fa fa-' . $icon . '"></i>'; $output .= ' <p>' . $content . '</p>'; $output .= ' <i class="grve-close grve-icon-close"></i>'; $output .= '</div>'; return $output; }
function grve_calout_shortcode($atts, $content) { $output = $button = $data = $class_leader = $el_class = ''; extract(shortcode_atts(array('title' => '', 'button_text' => '', 'button_link' => '', 'button_type' => 'simple', 'btn_position' => 'btn-right', 'button_size' => 'medium', 'button_color' => 'primary-1', 'button_shape' => 'square', 'button_class' => '', 'leader_text' => '', 'animation' => '', 'animation_delay' => '200', 'margin_bottom' => '', 'el_class' => ''), $atts)); if ('yes' == $leader_text) { $class_leader = 'grve-leader-text'; } //Button $button = grve_osmosis_vce_get_button($button_text, $button_link, $button_type, $button_size, $button_color, $button_shape, $button_class); $callout_classes = array('grve-element', 'grve-callout'); if (!empty($animation)) { array_push($callout_classes, 'grve-animated-item'); array_push($callout_classes, $animation); $data = ' data-delay="' . esc_attr($animation_delay) . '"'; } if (!empty($el_class)) { array_push($callout_classes, $el_class); } array_push($callout_classes, 'grve-' . $btn_position); $callout_class_string = implode(' ', $callout_classes); $style = grve_osmosis_vce_build_margin_bottom_style($margin_bottom); $output .= '<div class="' . esc_attr($callout_class_string) . '" style="' . $style . '">'; $output .= ' <div class="grve-callout-wrapper">'; if (!empty($title)) { $output .= ' <h5 class="grve-callout-content">' . $title . '</h5>'; } if (!empty($content)) { $output .= ' <p class="' . esc_attr($class_leader) . '">' . $content . '</p>'; } $output .= ' </div>'; $output .= ' <div class="grve-button-wrapper">'; $output .= $button; $output .= ' </div>'; $output .= '</div>'; return $output; }
function grve_dropcap_shortcode($atts, $content) { $output = $style = $data = $el_class = ''; extract(shortcode_atts(array('dropcap_style' => '1', 'bg_color' => 'primary-1', 'animation' => '', 'animation_delay' => '200', 'margin_bottom' => '', 'el_class' => ''), $atts)); $style = grve_osmosis_vce_build_margin_bottom_style($margin_bottom); $dropcap_classes = array('grve-element', 'grve-dropcap'); if (!empty($animation)) { array_push($dropcap_classes, 'grve-animated-item'); array_push($dropcap_classes, $animation); $data = ' data-delay="' . esc_attr($animation_delay) . '"'; } if (!empty($el_class)) { array_push($dropcap_classes, $el_class); } $dropcap_class_string = implode(' ', $dropcap_classes); if (!empty($content)) { $dropcap_char = mb_substr($content, 0, 1, 'UTF8'); $dropcap_content = mb_substr($content, 1, mb_strlen($content), 'UTF8'); $output .= '<div class="' . esc_attr($dropcap_class_string) . '" style="' . $style . '"' . $data . '>'; $output .= '<p><span class="grve-style-' . esc_attr($dropcap_style) . ' grve-bg-' . esc_attr($bg_color) . '">' . $dropcap_char . '</span>' . $dropcap_content . '</p>'; $output .= '</div>'; } return $output; }
function grve_blog_shortcode($atts, $content) { $output = $allow_filter = $el_class = ''; extract(shortcode_atts(array('categories' => '', 'blog_style' => 'large-media', 'blog_mode' => 'no-border-mode', 'blog_image_mode' => '', 'blog_image_prio' => '', 'blog_columns' => '4', 'auto_excerpt' => '', 'excerpt_length' => '55', 'excerpt_more' => '', 'hide_comments' => '', 'posts_per_page' => '10', 'order_by' => 'date', 'order' => 'DESC', 'disable_pagination' => '', 'blog_filter' => '', 'blog_filter_align' => 'left', 'filter_order_by' => '', 'filter_order' => 'ASC', 'item_spinner' => 'no', 'items_per_page' => '4', 'slideshow_speed' => '3000', 'navigation_type' => '1', 'navigation_color' => 'light', 'pause_hover' => 'no', 'margin_bottom' => '', 'el_class' => ''), $atts)); $style = grve_osmosis_vce_build_margin_bottom_style($margin_bottom); $blog_classes = array('grve-element'); array_push($blog_classes, grve_osmosis_vce_get_blog_class($blog_style)); if (!empty($el_class)) { array_push($blog_classes, $el_class); } if ('border-mode' == $blog_mode && ('masonry' == $blog_style || 'grid' == $blog_style)) { array_push($blog_classes, 'grve-border-mode'); } $blog_class_string = implode(' ', $blog_classes); global $paged; $paged = 1; if ('yes' != $disable_pagination) { if (get_query_var('paged')) { $paged = get_query_var('paged'); } elseif (get_query_var('page')) { $paged = get_query_var('page'); } } $args = array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => $posts_per_page, 'cat' => $categories, 'paged' => $paged, 'ignore_sticky_posts' => 1, 'orderby' => $order_by, 'order' => $order); $query = new WP_Query($args); $blog_category_ids = array(); if (!empty($categories)) { $blog_category_ids = explode(",", $categories); } if ('carousel' != $blog_style) { $allow_filter = 'yes'; } $category_prefix = '.category-'; ob_start(); if ($query->have_posts()) { ?> <div class="<?php echo esc_attr($blog_class_string); ?> " style="<?php echo $style; ?> " <?php grve_osmosis_vce_print_blog_data($blog_style, $blog_columns, $item_spinner); ?> > <?php //Category Filter if ('yes' == $blog_filter && 'yes' == $allow_filter) { $category_filter_list = array(); $category_filter_array = array(); $all_string = apply_filters('grve_vce_blog_string_all_categories', __('All', 'grve-osmosis-vc-extension')); $category_filter_string = '<li data-filter="*" class="selected">' . $all_string . '</li>'; $category_filter_add = false; while ($query->have_posts()) { $query->the_post(); if ($blog_categories = get_the_terms(get_the_ID(), 'category')) { foreach ($blog_categories as $category_term) { $category_filter_add = false; if (!in_array($category_term->term_id, $category_filter_list)) { if (!empty($blog_category_ids)) { if (in_array($category_term->term_id, $blog_category_ids)) { $category_filter_add = true; } } else { $category_filter_add = true; } if ($category_filter_add) { $category_filter_list[] = $category_term->term_id; if ('title' == $filter_order_by) { $category_filter_array[$category_term->name] = $category_term; } elseif ('slug' == $filter_order_by) { $category_filter_array[$category_term->slug] = $category_term; } else { $category_filter_array[$category_term->term_id] = $category_term; } } } } } } if (count($category_filter_array) > 1) { if ('' != $filter_order_by) { if ('ASC' == $filter_order) { ksort($category_filter_array); } else { krsort($category_filter_array); } } foreach ($category_filter_array as $category_filter) { $category_filter_string .= '<li data-filter="' . $category_prefix . $category_filter->slug . '">' . $category_filter->name . '</li>'; } ?> <div class="grve-filter grve-align-<?php echo esc_attr($blog_filter_align); ?> "> <ul> <?php echo $category_filter_string; ?> </ul> </div> <?php } } if ('large-media' == $blog_style || 'small-media' == $blog_style) { ?> <div class="grve-standard-container"> <?php } else { if ('carousel' == $blog_style) { $disable_pagination = 'yes'; $data_string = ' data-items="' . esc_attr($items_per_page) . '" data-slider-speed="' . esc_attr($slideshow_speed) . '" data-slider-pause="' . esc_attr($pause_hover) . '"'; ?> <?php if (0 != $navigation_type) { ?> <div class="grve-carousel-navigation grve-<?php echo $navigation_color; ?> " data-navigation-type="<?php echo $navigation_type; ?> "> <div class="grve-carousel-buttons"> <div class="grve-carousel-prev grve-icon-nav-left"></div> <div class="grve-carousel-next grve-icon-nav-right"></div> </div> </div> <?php } ?> <div class="grve-carousel grve-carousel-element"<?php echo $data_string; ?> > <?php } else { ?> <div class="grve-isotope-container"> <?php } } $grve_isotope_start = $grve_isotope_end = ''; if ('large-media' != $blog_style && 'small-media' != $blog_style) { $grve_isotope_start = '<div class="grve-isotope-item-inner">'; $grve_isotope_end = '</div>'; } while ($query->have_posts()) { $query->the_post(); $post_format = get_post_format(); if ('link' == $post_format || 'quote' == $post_format) { $grve_post_class = grve_osmosis_vce_get_post_class($blog_style, 'grve-label-post'); } else { $grve_post_class = grve_osmosis_vce_get_post_class($blog_style); } if ('carousel' == $blog_style) { ?> <div class="grve-carousel-item"> <article class="format-gallery grve-post-item" itemscope itemType="http://schema.org/BlogPosting"> <?php grve_osmosis_vce_print_carousel_media(); ?> <div class="grve-content"> <?php grve_osmosis_vce_print_post_title($blog_style, $post_format); ?> <div class="grve-caption"> <?php grve_osmosis_vce_print_post_date(); ?> </div> </div> </article> </div> <?php } else { ?> <article id="post-<?php the_ID(); ?> " <?php post_class($grve_post_class); ?> itemscope itemType="http://schema.org/BlogPosting"> <?php echo $grve_isotope_start; ?> <?php grve_osmosis_vce_print_post_feature_media($blog_style, $post_format, $blog_image_mode, $blog_image_prio); ?> <?php if ('link' != $post_format && 'quote' != $post_format) { ?> <div class="grve-post-content"> <?php grve_osmosis_vce_print_post_title($blog_style, $post_format); ?> <div class="grve-post-meta"> <?php grve_osmosis_vce_print_post_author_by($blog_style); ?> <?php grve_osmosis_vce_print_post_date(); ?> <?php if (function_exists('grve_print_like_counter')) { grve_print_like_counter(); } ?> </div> <?php grve_osmosis_vce_print_post_excerpt($blog_style, $post_format, $auto_excerpt, $excerpt_length, $excerpt_more); ?> </div> <?php } else { ?> <?php grve_osmosis_vce_print_post_title($blog_style, $post_format); ?> <?php } ?> <?php echo $grve_isotope_end; ?> </article> <?php } } ?> </div> <?php if ('yes' != $disable_pagination) { $total = $query->max_num_pages; $big = 999999999; // need an unlikely integer if ($total > 1) { echo '<div class="grve-pagination">'; if (!($current_page = $paged)) { $current_page = 1; } if (get_option('permalink_structure')) { $format = 'page/%#%/'; } else { $format = '&paged=%#%'; } echo paginate_links(array('base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), 'format' => $format, 'current' => max(1, $paged), 'total' => $total, 'mid_size' => 2, 'type' => 'list', 'prev_text' => '<i class="grve-icon-nav-left"></i>', 'next_text' => '<i class="grve-icon-nav-right"></i>', 'add_args' => false)); echo '</div>'; } } ?> </div> <?php } else { } wp_reset_postdata(); return ob_get_clean(); }
function grve_gallery_shortcode($attr, $content) { $output = $start_block = $end_block = $item_class = $class_fullwidth = $el_class = ''; extract(shortcode_atts(array('ids' => '', 'gallery_type' => 'grid', 'gallery_columns' => '3', 'item_gutter' => 'yes', 'hide_image_title' => '', 'hide_image_caption' => '', 'zoom_effect' => 'in', 'overlay_color' => 'dark', 'overlay_opacity' => '60', 'items_per_page' => '4', 'slideshow_speed' => '3000', 'auto_play' => 'yes', 'navigation_type' => '1', 'navigation_color' => 'light', 'pause_hover' => 'no', 'margin_bottom' => '', 'el_class' => ''), $attr)); $attachments = explode(",", $ids); if (empty($attachments)) { return ''; } //Gallery Classes $gallery_classes = array('grve-element', 'grve-gallery', 'grve-isotope', 'grve-gallery-popup'); if (!empty($el_class)) { array_push($gallery_classes, $el_class); } $gallery_class_string = implode(' ', $gallery_classes); $style = grve_osmosis_vce_build_margin_bottom_style($margin_bottom); $data_string = ''; switch ($gallery_type) { case 'masonry': $data_string = ' data-gutter="' . esc_attr($item_gutter) . '" data-type="' . esc_attr($gallery_columns) . '-columns" data-layout="masonry"'; break; case 'multi-grid': $data_string = ' data-gutter="' . esc_attr($item_gutter) . '" data-type="' . esc_attr($gallery_columns) . '-columns" data-layout="packery"'; break; case 'carousel': $data_string = ' data-items="' . esc_attr($items_per_page) . '" data-slider-autoplay="' . esc_attr($auto_play) . '" data-slider-speed="' . esc_attr($slideshow_speed) . '" data-slider-pause="' . esc_attr($pause_hover) . '"'; break; case 'grid': default: $data_string = ' data-gutter="' . esc_attr($item_gutter) . '" data-type="' . esc_attr($gallery_columns) . '-columns" data-layout="fitRows"'; break; } if ('carousel' == $gallery_type) { //Gallery Output ( carousel) $image_size = 'grve-image-small-rect-horizontal'; $output .= '<div class="grve-element grve-carousel-wrapper" style="' . $style . '">'; if (0 != $navigation_type) { $output .= '<div class="grve-carousel-navigation grve-' . esc_attr($navigation_color) . '" data-navigation-type="' . esc_attr($navigation_type) . '">'; $output .= ' <div class="grve-carousel-buttons">'; $output .= ' <div class="grve-carousel-prev grve-icon-nav-left"></div>'; $output .= ' <div class="grve-carousel-next grve-icon-nav-right"></div>'; $output .= ' </div>'; $output .= '</div>'; } $output .= ' <div class="grve-carousel grve-carousel-element ' . esc_attr($el_class) . '"' . $data_string . '> '; foreach ($attachments as $id) { $thumb_src = wp_get_attachment_image_src($id, $image_size); $image_dimensions = 'width="' . $thumb_src[1] . '" height="' . $thumb_src[2] . '"'; $alt = get_post_meta($id, '_wp_attachment_image_alt', true); $alt = !empty($alt) ? esc_attr($alt) : ''; $output .= '<div class="grve-carousel-item">'; $output .= ' <figure class="grve-image-hover">'; $output .= ' <div class="grve-media">'; $output .= ' <img src="' . esc_url($thumb_src[0]) . '" alt="' . $alt . '" ' . $image_dimensions . '>'; $output .= ' </div>'; $output .= ' </figure>'; $output .= '</div>'; } $output .= ' </div>'; $output .= '</div>'; } else { //Gallery Output ( grid / multi-grid / masonry) $output .= '<div class="' . esc_attr($gallery_class_string) . '" style="' . $style . '"' . $data_string . '>'; $output .= ' <div class="grve-isotope-container">'; $gallery_index = 0; $image_size = 'grve-image-small-square'; $image_size_class = ''; foreach ($attachments as $id) { $gallery_index++; if ('multi-grid' == $gallery_type) { $grve_packery_data = grve_osmosis_vce_get_packery_data($gallery_index, $gallery_columns); $image_size_class = ' ' . $grve_packery_data['class']; $image_size = $grve_packery_data['image_size']; } elseif ('masonry' == $gallery_type) { $grve_masonry_data = grve_osmosis_vce_get_masonry_data($gallery_index, $gallery_columns); $image_size_class = ' ' . $grve_masonry_data['class']; $image_size = $grve_masonry_data['image_size']; } $image_link_href = wp_get_attachment_url($id); $thumb_src = wp_get_attachment_image_src($id, $image_size); $image_dimensions = 'width="' . $thumb_src[1] . '" height="' . $thumb_src[2] . '"'; $full_src = wp_get_attachment_image_src($id, 'grve-image-fullscreen'); $image_title = get_post_field('post_title', $id); $caption = get_post_field('post_excerpt', $id); $alt = get_post_meta($id, '_wp_attachment_image_alt', true); $alt = !empty($alt) ? esc_attr($alt) : wptexturize($image_title); $output .= '<div class="grve-isotope-item ' . $image_size_class . '">'; $output .= ' <a href="' . esc_url($full_src[0]) . '">'; $output .= ' <figure class="grve-image-hover grve-zoom-' . $zoom_effect . '">'; $output .= ' <div class="grve-media grve-' . $overlay_color . '-overlay grve-opacity-' . $overlay_opacity . '">'; $output .= ' <img src="' . esc_url($thumb_src[0]) . '" alt="' . $alt . '" ' . $image_dimensions . '>'; $output .= ' </div>'; $output .= ' <figcaption>'; if (!empty($image_title) && 'yes' != $hide_image_title) { $output .= '<h6 class="grve-title grve-' . esc_attr($overlay_color) . '">' . wptexturize($image_title) . '</h6>'; } if (!empty($caption) && 'yes' != $hide_image_caption) { $output .= '<span class="grve-caption grve-' . esc_attr($overlay_color) . '">' . wptexturize($caption) . '</span>'; } $output .= ' </figcaption>'; $output .= ' </figure>'; $output .= ' </a>'; $output .= '</div>'; } $output .= ' </div>'; $output .= '</div>'; } return $output; }
function grve_image_text_shortcode($atts, $content) { $output = $output_image = $data = $retina_data = $el_class = ''; extract(shortcode_atts(array('title' => '', 'image' => '', 'retina_image' => '', 'image_align' => 'left', 'video_popup' => '', 'video_link' => '', 'read_more_title' => '', 'read_more_link' => '', 'read_more_class' => '', 'animation' => '', 'animation_delay' => '200', 'margin_bottom' => '', 'el_class' => ''), $atts)); if (!empty($read_more_link)) { $href = vc_build_link($read_more_link); $url = $href['url']; if (!empty($href['target'])) { $target = $href['target']; } else { $target = "_self"; } } else { $url = "#"; $target = "_self"; } $style = grve_osmosis_vce_build_margin_bottom_style($margin_bottom); $image_text_classes = array('grve-element', 'grve-image-text'); if (!empty($animation)) { array_push($image_text_classes, 'grve-animated-item'); array_push($image_text_classes, $animation); $data = ' data-delay="' . esc_attr($animation_delay) . '"'; } if (!empty($el_class)) { array_push($image_text_classes, $el_class); } $image_text_class_string = implode(' ', $image_text_classes); $output .= '<div class="' . esc_attr($image_text_class_string) . '" style="' . $style . '"' . $data . '>'; if (!empty($image)) { $img_id = preg_replace('/[^\\d]/', '', $image); $img_src = wp_get_attachment_image_src($img_id, 'full'); $image_dimensions = 'width="' . $img_src[1] . '" height="' . $img_src[2] . '"'; if (!empty($retina_image)) { $img_retina_id = preg_replace('/[^\\d]/', '', $retina_image); $img_retina_src = wp_get_attachment_image_src($img_retina_id, 'full'); $retina_data = ' data-at2x="' . esc_attr($img_retina_src[0]) . '"'; } $alt = get_post_meta($img_id, '_wp_attachment_image_alt', true); $alt = !empty($alt) ? esc_attr($alt) : ''; if ('yes' == $video_popup && !empty($video_link)) { $output_image .= '<div class="grve-image">'; $output_image .= ' <a class="grve-vimeo-popup grve-icon-video" href="' . esc_url($video_link) . '">'; $output_image .= ' <img alt="' . $alt . '" src="' . esc_url($img_src[0]) . '" ' . $image_dimensions . $retina_data . '>'; $output_image .= ' </a>'; $output_image .= '</div>'; } else { $output_image .= '<div class="grve-image">'; $output_image .= ' <img alt="' . $alt . '" src="' . esc_url($img_src[0]) . '" ' . $image_dimensions . $retina_data . '>'; $output_image .= '</div>'; } if ('left' == $image_align) { $output .= $output_image; } $output .= ' <div class="grve-content grve-align-' . esc_attr($image_align) . '">'; if (!empty($title)) { $output .= ' <h4>' . $title . '</h4>'; } if (!empty($content)) { $output .= ' <p>' . $content . '</p>'; } if (!empty($read_more_title) && !empty($url)) { $output .= ' <a href="' . esc_url($url) . '" target="' . $target . '" class="grve-read-more ' . esc_attr($read_more_class) . '">'; $output .= $read_more_title; $output .= '</a>'; } $output .= ' </div>'; if ('right' == $image_align) { $output .= $output_image; } $output .= '</div>'; } return $output; }
function grve_osmosis_social_shortcode($atts, $content) { $output = $data = $el_class = ''; extract(shortcode_atts(array('social_facebook' => '', 'social_twitter' => '', 'social_linkedin' => '', 'social_googleplus' => '', 'social_reddit' => '', 'grve_likes' => '', 'animation' => '', 'align' => 'left', 'animation_delay' => '200', 'margin_bottom' => '', 'el_class' => ''), $atts)); $social_classes = array('grve-element', 'grve-social', 'grve-social-large', 'grve-align-' . $align); if (!empty($animation)) { array_push($social_classes, 'grve-animated-item'); array_push($social_classes, $animation); $data = ' data-delay="' . esc_attr($animation_delay) . '"'; } if (!empty($el_class)) { array_push($social_classes, $el_class); } $social_class_string = implode(' ', $social_classes); $style = grve_osmosis_vce_build_margin_bottom_style($margin_bottom); $grve_permalink = esc_url(get_permalink()); $grve_title = esc_attr(get_the_title()); ob_start(); ?> <div class="<?php echo esc_attr($social_class_string); ?> " style="<?php echo $style; ?> "<?php echo $data; ?> > <ul> <?php if (!empty($social_facebook)) { ?> <li><a href="<?php echo $grve_permalink; ?> " title="<?php echo $grve_title; ?> " class="grve-social-share-facebook grve-icon-facebook"></a></li> <?php } ?> <?php if (!empty($social_twitter)) { ?> <li><a href="<?php echo $grve_permalink; ?> " title="<?php echo $grve_title; ?> " class="grve-social-share-twitter grve-icon-twitter"></a></li> <?php } ?> <?php if (!empty($social_linkedin)) { ?> <li><a href="<?php echo $grve_permalink; ?> " title="<?php echo $grve_title; ?> " class="grve-social-share-linkedin grve-icon-linkedin"></a></li> <?php } ?> <?php if (!empty($social_googleplus)) { ?> <li><a href="<?php echo $grve_permalink; ?> " title="<?php echo $grve_title; ?> " class="grve-social-share-googleplus grve-icon-google-plus"></a></li> <?php } ?> <?php if (!empty($social_reddit)) { ?> <li><a href="<?php echo $grve_permalink; ?> " title="<?php echo $grve_title; ?> " class="grve-social-share-reddit grve-icon-reddit"></a></li> <?php } ?> <?php if (!empty($grve_likes) && function_exists('grve_likes')) { global $post; $post_id = $post->ID; ?> <li><a href="#" class="grve-like-counter-link grve-icon-heart" data-post-id="<?php echo $post_id; ?> "></a><span class="grve-like-counter"><?php echo grve_likes($post_id); ?> </span></li> <?php } ?> </ul> </div> <?php return ob_get_clean(); }
function grve_team_shortcode($attr, $content) { $output = $data = $el_class = ''; extract(shortcode_atts(array('image' => '', 'team_style' => '1', 'name' => '', 'identity' => '', 'social_facebook' => '', 'social_twitter' => '', 'social_linkedin' => '', 'email' => '', 'link' => '', 'zoom_effect' => 'in', 'overlay_color' => 'dark', 'overlay_opacity' => '60', 'animation' => '', 'animation_delay' => '200', 'margin_bottom' => '', 'el_class' => ''), $attr)); $image_size = 'grve-image-small-square'; $team_style_classes = array('grve-image-hover'); array_push($team_style_classes, 'grve-style-' . $team_style); array_push($team_style_classes, 'grve-zoom-' . $zoom_effect); $team_style_string = implode(' ', $team_style_classes); $style = grve_osmosis_vce_build_margin_bottom_style($margin_bottom); if (!empty($image)) { $id = preg_replace('/[^\\d]/', '', $image); $thumb_src = wp_get_attachment_image_src($id, $image_size); $image_src = $thumb_src[0]; $image_dimensions = 'width="' . $thumb_src[1] . '" height="' . $thumb_src[2] . '"'; $alt = get_post_meta($id, '_wp_attachment_image_alt', true); $alt = !empty($alt) ? esc_attr($alt) : $name; } else { $image_src = GRVE_OSMOSIS_VC_EXT_PLUGIN_DIR_URL . 'assets/images/empty/' . $image_size . '.jpg'; $image_dimensions = ''; $alt = "Empty Team"; } $image_string = ' <img src="' . $image_src . '" alt="' . $alt . '" ' . $image_dimensions . '>'; if (!empty($link)) { $href = vc_build_link($link); $url = $href['url']; if (!empty($href['target'])) { $target = $href['target']; } else { $target = "_self"; } } else { $url = "#"; $target = "_self"; } $links = ''; if (!empty($social_facebook)) { $links .= '<li><a href="' . esc_url($social_facebook) . '" target="_blank">Facebook</a></li>'; } if (!empty($social_twitter)) { $links .= '<li><a href="' . esc_url($social_twitter) . '" target="_blank">Twitter</a></li>'; } if (!empty($social_linkedin)) { $links .= '<li><a href="' . esc_url($social_linkedin) . '" target="_blank">Linkedin</a></li>'; } if (!empty($email)) { $links .= '<li><a href="mailto:' . antispambot($email) . '">E-mail</a></li>'; } $team_classes = array('grve-element'); if (!empty($animation)) { array_push($team_classes, 'grve-animated-item'); array_push($team_classes, $animation); $data = ' data-delay="' . esc_attr($animation_delay) . '"'; } if (!empty($el_class)) { array_push($team_classes, $el_class); } $team_class_string = implode(' ', $team_classes); ob_start(); ?> <div class="grve-team <?php echo esc_attr($team_class_string); ?> " style="<?php echo $style; ?> "<?php echo $data; ?> > <figure class="<?php echo esc_attr($team_style_string); ?> "> <div class="grve-team-person grve-media grve-<?php echo esc_attr($overlay_color); ?> -overlay grve-opacity-<?php echo esc_attr($overlay_opacity); ?> "> <?php echo $image_string; ?> </div> <figcaption> <div class="grve-team-description"> <?php if (!empty($url) && '#' != $url) { ?> <a href="<?php echo esc_url($url); ?> " target="<?php echo $target; ?> "> <?php } ?> <h6 class="grve-team-name grve-<?php echo esc_attr($overlay_color); ?> "><?php echo $name; ?> </h6> <?php if (!empty($url) && '#' != $url) { ?> </a> <?php } ?> <small class="grve-team-identity grve-<?php echo esc_attr($overlay_color); ?> "><?php echo $identity; ?> </small> </div> <div class="grve-team-social grve-<?php echo esc_attr($overlay_color); ?> "> <ul> <?php echo $links; ?> </ul> </div> </figcaption> </figure> </div> <?php return ob_get_clean(); }
function grve_portfolio_shortcode($attr, $content) { $portfolio_row_start = $allow_filter = $class_fullwidth = $el_class = ''; extract(shortcode_atts(array('categories' => '', 'portfolio_style' => 'grid', 'portfolio_columns' => '3', 'portfolio_image_mode' => '', 'portfolio_link_type' => 'item', 'portfolio_link_type_title' => 'More Details', 'portfolio_filter' => '', 'portfolio_filter_align' => 'left', 'filter_order_by' => '', 'filter_order' => 'ASC', 'item_gutter' => 'yes', 'item_spinner' => 'no', 'items_per_page' => '4', 'items_to_show' => '12', 'hide_portfolio_title' => '', 'hide_portfolio_caption' => '', 'hide_portfolio_like' => '', 'portfolio_hover_style' => 'hover-style-1', 'zoom_effect' => 'in', 'overlay_color' => 'dark', 'overlay_opacity' => '60', 'order_by' => 'date', 'order' => 'DESC', 'disable_pagination' => '', 'slideshow_speed' => '3000', 'auto_play' => 'yes', 'navigation_type' => '1', 'navigation_color' => 'light', 'pause_hover' => 'no', 'margin_bottom' => '', 'el_class' => ''), $attr)); $portfolio_classes = array('grve-element'); $data_string = ''; switch ($portfolio_style) { case 'carousel': $data_string = ' data-items="' . esc_attr($items_per_page) . '" data-slider-autoplay="' . esc_attr($auto_play) . '" data-slider-speed="' . esc_attr($slideshow_speed) . '" data-slider-pause="' . esc_attr($pause_hover) . '"'; array_push($portfolio_classes, 'grve-carousel-wrapper'); if ('popup' == $portfolio_link_type) { array_push($portfolio_classes, 'grve-gallery-popup'); } $disable_pagination = 'yes'; break; case 'masonry': $portfolio_row_start = '<div class="grve-isotope-container">'; if ('popup' == $portfolio_link_type) { $portfolio_row_start = '<div class="grve-isotope-container grve-gallery-popup">'; } $data_string = ' data-gutter="' . esc_attr($item_gutter) . '" data-spinner="' . esc_attr($item_spinner) . '" data-type="' . esc_attr($portfolio_columns) . '-columns" data-layout="masonry"'; array_push($portfolio_classes, 'grve-portfolio'); array_push($portfolio_classes, 'grve-isotope'); $allow_filter = 'yes'; break; case 'multi-grid': $portfolio_row_start = '<div class="grve-isotope-container">'; if ('popup' == $portfolio_link_type) { $portfolio_row_start = '<div class="grve-isotope-container grve-gallery-popup">'; } $data_string = ' data-gutter="' . esc_attr($item_gutter) . '" data-spinner="' . esc_attr($item_spinner) . '" data-type="' . esc_attr($portfolio_columns) . '-columns" data-layout="packery"'; array_push($portfolio_classes, 'grve-portfolio'); array_push($portfolio_classes, 'grve-isotope'); $allow_filter = 'yes'; break; case 'small-media': $portfolio_row_start = '<div class="grve-standard-container">'; array_push($portfolio_classes, 'grve-portfolio'); array_push($portfolio_classes, 'grve-blog'); array_push($portfolio_classes, 'grve-small-media'); array_push($portfolio_classes, 'grve-non-isotope'); $allow_filter = 'yes'; $portfolio_link_type = 'item'; break; case 'grid': default: $portfolio_row_start = '<div class="grve-isotope-container">'; if ('popup' == $portfolio_link_type) { $portfolio_row_start = '<div class="grve-isotope-container grve-gallery-popup">'; } $data_string = ' data-gutter="' . esc_attr($item_gutter) . '" data-spinner="' . esc_attr($item_spinner) . '" data-type="' . esc_attr($portfolio_columns) . '-columns" data-layout="fitRows"'; array_push($portfolio_classes, 'grve-portfolio'); array_push($portfolio_classes, 'grve-isotope'); $allow_filter = 'yes'; break; } if (!empty($el_class)) { array_push($portfolio_classes, $el_class); } $portfolio_class_string = implode(' ', $portfolio_classes); $style = grve_osmosis_vce_build_margin_bottom_style($margin_bottom); $portfolio_cat = ""; $portfolio_category_ids = array(); if (!empty($categories)) { $portfolio_category_ids = explode(",", $categories); foreach ($portfolio_category_ids as $category_id) { $category_term = get_term($category_id, 'portfolio_category'); if (isset($category_term)) { $portfolio_cat = $portfolio_cat . $category_term->slug . ', '; } } } global $paged; $paged = 1; if ('yes' != $disable_pagination) { if (get_query_var('paged')) { $paged = get_query_var('paged'); } elseif (get_query_var('page')) { $paged = get_query_var('page'); } } $args = array('post_type' => 'portfolio', 'post_status' => 'publish', 'paged' => $paged, 'portfolio_category' => $portfolio_cat, 'posts_per_page' => $items_to_show, 'orderby' => $order_by, 'order' => $order); $query = new WP_Query($args); ob_start(); if ($query->have_posts()) { ?> <div class="<?php echo esc_attr($portfolio_class_string); ?> " style="<?php echo $style; ?> "<?php echo $data_string; ?> > <?php if ('yes' == $portfolio_filter && 'yes' == $allow_filter) { $category_prefix = '.portfolio_category_'; $category_filter_list = array(); $category_filter_array = array(); $all_string = apply_filters('grve_vce_portfolio_string_all_categories', __('All', 'grve-osmosis-vc-extension')); $category_filter_string = '<li data-filter="*" class="selected">' . $all_string . '</li>'; $category_filter_add = false; while ($query->have_posts()) { $query->the_post(); if ($portfolio_categories = get_the_terms(get_the_ID(), 'portfolio_category')) { foreach ($portfolio_categories as $category_term) { $category_filter_add = false; if (!in_array($category_term->term_id, $category_filter_list)) { if (!empty($portfolio_category_ids)) { if (in_array($category_term->term_id, $portfolio_category_ids)) { $category_filter_add = true; } } else { $category_filter_add = true; } if ($category_filter_add) { $category_filter_list[] = $category_term->term_id; if ('title' == $filter_order_by) { $category_filter_array[$category_term->name] = $category_term; } elseif ('slug' == $filter_order_by) { $category_filter_array[$category_term->slug] = $category_term; } else { $category_filter_array[$category_term->term_id] = $category_term; } } } } } } if (count($category_filter_array) > 1) { if ('' != $filter_order_by) { if ('ASC' == $filter_order) { ksort($category_filter_array); } else { krsort($category_filter_array); } } foreach ($category_filter_array as $category_filter) { $category_filter_string .= '<li data-filter="' . $category_prefix . $category_filter->slug . '">' . $category_filter->name . '</li>'; } ?> <div class="grve-filter grve-align-<?php echo esc_attr($portfolio_filter_align); ?> "> <ul> <?php echo $category_filter_string; ?> </ul> </div> <?php } } ?> <?php echo $portfolio_row_start; ?> <?php if ('carousel' == $portfolio_style) { ?> <?php if (0 != $navigation_type) { ?> <div class="grve-carousel-navigation grve-<?php echo esc_attr($navigation_color); ?> " data-navigation-type="<?php echo esc_attr($navigation_type); ?> "> <div class="grve-carousel-buttons"> <div class="grve-carousel-prev grve-icon-nav-left"></div> <div class="grve-carousel-next grve-icon-nav-right"></div> </div> </div> <?php } ?> <div class="grve-carousel grve-carousel-element grve-portfolio"<?php echo $data_string; ?> > <?php } $portfolio_index = 0; while ($query->have_posts()) { $query->the_post(); $image_size = 'grve-image-small-rect-horizontal'; $portfolio_index++; $portfolio_extra_class = ''; $caption = get_post_meta(get_the_ID(), 'grve_portfolio_description', true); $details = get_post_meta(get_the_ID(), 'grve_portfolio_details', true); $link_mode = get_post_meta(get_the_ID(), 'grve_portfolio_link_mode', true); $link_url = get_post_meta(get_the_ID(), 'grve_portfolio_link_url', true); $new_window = get_post_meta(get_the_ID(), 'grve_portfolio_link_new_window', true); $link_class = get_post_meta(get_the_ID(), 'grve_portfolio_link_extra_class', true); if ('carousel' != $portfolio_style) { $image_size = 'grve-image-small-square'; $portfolio_extra_class = 'grve-isotope-item grve-portfolio-item '; if ('multi-grid' == $portfolio_style) { $grve_packery_data = grve_osmosis_vce_get_packery_data($portfolio_index, $portfolio_columns); $portfolio_extra_class .= $grve_packery_data['class']; $image_size = $grve_packery_data['image_size']; } elseif ('masonry' == $portfolio_style) { if ('resize' == $portfolio_image_mode) { $portfolio_extra_class .= 'grve-masonry-image'; $image_size = 'large'; } else { $grve_masonry_data = grve_osmosis_vce_get_masonry_data($portfolio_index, $portfolio_columns); $portfolio_extra_class .= $grve_masonry_data['class']; $image_size = $grve_masonry_data['image_size']; } } elseif ('grid' == $portfolio_style) { if ('resize' == $portfolio_image_mode) { $image_size = 'large'; } } else { $portfolio_extra_class = 'grve-non-isotope-item grve-blog-item grve-small-post'; $image_size = 'grve-image-small-rect-horizontal'; if ('resize' == $portfolio_image_mode) { $image_size = 'large'; } } } else { $portfolio_extra_class = 'grve-portfolio-item'; echo '<div class="grve-carousel-item">'; } //Portfolio Link $portfolio_link_exists = true; $grve_target = '_self'; if (!empty($new_window)) { $grve_target = '_blank'; } ob_start(); if ('small-media' == $portfolio_style) { ?> <a title="<?php the_title(); ?> " href="<?php echo esc_url(get_permalink()); ?> "> <?php } else { if ('popup' == $portfolio_link_type) { ?> <a title="<?php the_title(); ?> " href="<?php grve_osmosis_vce_print_portfolio_image('full', 'link'); ?> "> <?php } else { if ('custom-link' == $portfolio_link_type) { if ('' == $link_mode) { ?> <a title="<?php the_title(); ?> " href="<?php echo esc_url(get_permalink()); ?> "> <?php } else { if ('link' == $link_mode && !empty($link_url)) { ?> <a title="<?php the_title(); ?> " class="<?php echo esc_attr($link_class); ?> " href="<?php echo esc_url($link_url); ?> " target="<?php echo esc_attr($grve_target); ?> "> <?php } else { $portfolio_link_exists = false; } } } else { ?> <a title="<?php the_title(); ?> " href="<?php echo esc_url(get_permalink()); ?> "> <?php } } } $link_start = ob_get_clean(); if ($portfolio_link_exists) { $link_end = '</a>'; } else { $link_end = ''; } ?> <article id="portfolio-<?php the_ID(); echo uniqid('-'); ?> " <?php post_class($portfolio_extra_class); ?> > <?php if ('carousel' == $portfolio_style) { ?> <figure class="grve-hover-style-1 grve-image-hover grve-zoom-<?php echo esc_attr($zoom_effect); ?> grve-<?php echo esc_attr($overlay_color); ?> "> <?php if (function_exists('grve_print_portfolio_like_counter') && 'yes' != $hide_portfolio_like) { grve_print_portfolio_like_counter(); } ?> <div class="grve-media grve-<?php echo esc_attr($overlay_color); ?> -overlay grve-opacity-<?php echo esc_attr($overlay_opacity); ?> "> <?php grve_osmosis_vce_print_portfolio_image($image_size); ?> </div> <figcaption> <?php if ('yes' != $hide_portfolio_title) { ?> <h6 class="grve-title grve-<?php echo esc_attr($overlay_color); ?> "><?php the_title(); ?> </h6> <?php } ?> <?php if (!empty($caption) && 'yes' != $hide_portfolio_caption) { ?> <span class="grve-caption grve-<?php echo esc_attr($overlay_color); ?> "><?php echo $caption; ?> </span> <?php } ?> <?php if ('popup' == $portfolio_link_type) { ?> <a title="<?php the_title(); ?> " class="grve-portfolio-btns" href="<?php grve_osmosis_vce_print_portfolio_image('full', 'link'); ?> "><?php echo $portfolio_link_type_title; ?> </a> <?php } elseif ($portfolio_link_exists) { if ('custom-link' == $portfolio_link_type && 'link' == $link_mode) { ?> <a class="grve-portfolio-btns" href="<?php echo esc_url($link_url); ?> " target="<?php echo esc_attr($grve_target); ?> "><?php echo $portfolio_link_type_title; ?> </a> <?php } else { ?> <a class="grve-portfolio-btns" href="<?php echo esc_url(get_permalink()); ?> "><?php echo $portfolio_link_type_title; ?> </a> <?php } } ?> </figcaption> </figure> <?php } elseif ('small-media' == $portfolio_style) { ?> <div class="grve-media grve-image-hover"> <?php echo $link_start; grve_osmosis_vce_print_portfolio_image($image_size); echo $link_end; ?> </div> <div class="grve-post-content"> <?php if ('yes' != $hide_portfolio_title) { ?> <?php echo $link_start; ?> <h4 class="grve-title grve-light"><?php the_title(); ?> </h4><?php echo $link_end; ?> <?php } ?> <div class="grve-post-meta"> <?php if (!empty($caption) && 'yes' != $hide_portfolio_caption) { ?> <span class="grve-caption grve-light"><?php echo $caption; ?> </span> <?php } ?> </div> <?php if (!empty($details)) { ?> <p><?php echo $details; ?> </p> <?php } ?> <a class="grve-read-more" href="<?php echo esc_url(get_permalink()); ?> "><?php echo $portfolio_link_type_title; ?> </a> </div> <?php } else { if ('hover-style-3' == $portfolio_hover_style) { ?> <?php echo $link_start; ?> <figure class="grve-hover-style-3 grve-image-hover grve-zoom-<?php echo esc_attr($zoom_effect); ?> grve-<?php echo esc_attr($overlay_color); ?> "> <div class="grve-media grve-<?php echo esc_attr($overlay_color); ?> -overlay grve-opacity-<?php echo esc_attr($overlay_opacity); ?> "> <?php if ($portfolio_link_exists) { ?> <span class="grve-portfolio-btns"><?php echo $portfolio_link_type_title; ?> </span> <?php } ?> <?php grve_osmosis_vce_print_portfolio_image($image_size); ?> </div> <?php if (function_exists('grve_print_portfolio_like_counter') && 'yes' != $hide_portfolio_like) { grve_print_portfolio_like_counter(); } ?> <figcaption> <?php if ('yes' != $hide_portfolio_title) { ?> <h6 class="grve-title grve-light"><?php the_title(); ?> </h6> <?php } ?> <?php if (!empty($caption) && 'yes' != $hide_portfolio_caption) { ?> <span class="grve-caption grve-light"><?php echo $caption; ?> </span> <?php } ?> </figcaption> </figure> <?php echo $link_end; ?> <?php } else { if ('hover-style-2' == $portfolio_hover_style) { ?> <?php echo $link_start; ?> <figure class="grve-hover-style-2 grve-<?php echo esc_attr($overlay_color); ?> "> <div class="grve-media"> <?php grve_osmosis_vce_print_portfolio_image($image_size); ?> </div> <figcaption class="grve-<?php echo esc_attr($overlay_color); ?> -overlay grve-opacity-<?php echo esc_attr($overlay_opacity); ?> "> <div class="grve-content"> <?php if (function_exists('grve_print_portfolio_like_counter') && 'yes' != $hide_portfolio_like) { grve_print_portfolio_like_counter(); } ?> <?php if ('yes' != $hide_portfolio_title) { ?> <h6 class="grve-title grve-<?php echo esc_attr($overlay_color); ?> "><?php the_title(); ?> </h6> <?php } ?> <?php if (!empty($caption) && 'yes' != $hide_portfolio_caption) { ?> <span class="grve-caption grve-<?php echo esc_attr($overlay_color); ?> "><?php echo $caption; ?> </span> <?php } ?> </div> </figcaption> </figure> <?php echo $link_end; ?> <?php } else { //Default Hover Style 1 ?> <?php echo $link_start; ?> <figure class="grve-hover-style-1 grve-image-hover grve-zoom-<?php echo esc_attr($zoom_effect); ?> grve-<?php echo esc_attr($overlay_color); ?> "> <?php if (function_exists('grve_print_portfolio_like_counter') && 'yes' != $hide_portfolio_like) { grve_print_portfolio_like_counter(); } ?> <div class="grve-media grve-<?php echo esc_attr($overlay_color); ?> -overlay grve-opacity-<?php echo esc_attr($overlay_opacity); ?> "> <?php grve_osmosis_vce_print_portfolio_image($image_size); ?> </div> <figcaption> <?php if ('yes' != $hide_portfolio_title) { ?> <h6 class="grve-title grve-<?php echo esc_attr($overlay_color); ?> "><?php the_title(); ?> </h6> <?php } ?> <?php if (!empty($caption) && 'yes' != $hide_portfolio_caption) { ?> <span class="grve-caption grve-<?php echo esc_attr($overlay_color); ?> "><?php echo $caption; ?> </span> <?php } ?> <?php if ($portfolio_link_exists) { ?> <span class="grve-portfolio-btns"><?php echo $portfolio_link_type_title; ?> </span> <?php } ?> </figcaption> </figure> <?php echo $link_end; ?> <?php } } } ?> </article> <?php if ('carousel' == $portfolio_style) { echo '</div>'; } } ?> </div> <?php if ('yes' != $disable_pagination) { $total = $query->max_num_pages; $big = 999999999; // need an unlikely integer if ($total > 1) { echo '<div class="grve-pagination">'; if (!($current_page = $paged)) { $current_page = 1; } if (get_option('permalink_structure')) { $format = 'page/%#%/'; } else { $format = '&paged=%#%'; } echo paginate_links(array('base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), 'format' => $format, 'current' => max(1, $paged), 'total' => $total, 'mid_size' => 2, 'type' => 'list', 'prev_text' => '<i class="grve-icon-nav-left"></i>', 'next_text' => '<i class="grve-icon-nav-right"></i>', 'add_args' => false)); echo '</div>'; } } ?> </div> <?php } else { } wp_reset_postdata(); return ob_get_clean(); }
function grve_testimonial_shortcode($attr, $content) { $portfolio_row_start = $allow_filter = $class_fullwidth = $slider_data = $output = $el_class = ''; extract(shortcode_atts(array('categories' => '', 'items_to_show' => '20', 'margin_bottom' => '', 'slideshow_speed' => '3000', 'pagination_speed' => '400', 'auto_play' => 'yes', 'navigation_type' => '1', 'pause_hover' => 'no', 'auto_height' => 'no', 'align' => 'left', 'text_style' => 'none', 'el_class' => ''), $attr)); $testimonial_classes = array('grve-element', 'grve-testimonial', 'grve-carousel-element', 'grve-align-' . $align); if (!empty($el_class)) { array_push($testimonial_classes, $el_class); } if ('none' != $text_style) { $text_style_class = 'grve-' . $text_style; array_push($testimonial_classes, $text_style_class); } $testimonial_class_string = implode(' ', $testimonial_classes); $style = grve_osmosis_vce_build_margin_bottom_style($margin_bottom); $slider_data = ''; $slider_data .= ' data-slider-speed="' . esc_attr($slideshow_speed) . '"'; $slider_data .= ' data-pagination-speed="' . esc_attr($pagination_speed) . '"'; $slider_data .= ' data-slider-autoheight="' . esc_attr($auto_height) . '"'; $slider_data .= ' data-navigation-type="' . esc_attr($navigation_type) . '"'; $slider_data .= ' data-slider-pause="' . esc_attr($pause_hover) . '"'; $slider_data .= ' data-slider-autoplay="' . esc_attr($auto_play) . '"'; $testimonial_cat = ""; if (!empty($categories)) { $testimonial_category_list = explode(",", $categories); foreach ($testimonial_category_list as $testimonial_list) { $testimonial_term = get_term($testimonial_list, 'testimonial_category'); $testimonial_cat = $testimonial_cat . $testimonial_term->slug . ', '; } } $args = array('post_type' => 'testimonial', 'post_status' => 'publish', 'paged' => 1, 'testimonial_category' => $testimonial_cat, 'posts_per_page' => $items_to_show); $query = new WP_Query($args); ob_start(); if ($query->have_posts()) { ?> <div class="<?php echo esc_attr($testimonial_class_string); ?> " style="<?php echo $style; ?> "<?php echo $slider_data; ?> > <?php while ($query->have_posts()) { $query->the_post(); $name = grve_post_meta('grve_testimonial_name'); $identity = grve_post_meta('grve_testimonial_identity'); if (!empty($identity)) { $identity = ', ' . $identity; } $name = '<span>' . $name . '</span>'; ?> <div class="grve-testimonial-element"> <?php the_content(); ?> <div class="grve-testimonial-name"><?php echo $name . $identity; ?> </div> </div> <?php } ?> </div> <?php } else { } wp_reset_postdata(); return ob_get_clean(); }
function grve_single_image_shortcode($attr, $content) { $output = $data = $retina_data = $el_class = ''; extract(shortcode_atts(array('image' => '', 'retina_image' => '', 'image_type' => 'image', 'link' => '', 'video_link' => '', 'animation' => '', 'animation_delay' => '200', 'margin_bottom' => '', 'el_class' => ''), $attr)); if (!empty($link)) { $href = vc_build_link($link); $url = $href['url']; if (!empty($href['target'])) { $target = $href['target']; } else { $target = "_self"; } } else { $url = "#"; $target = "_self"; } $single_image_classes = array('grve-element', 'grve-image', 'grve-align-center'); if (!empty($animation)) { array_push($single_image_classes, 'grve-animated-item'); array_push($single_image_classes, $animation); $data = ' data-delay="' . esc_attr($animation_delay) . '"'; } if (!empty($el_class)) { array_push($single_image_classes, $el_class); } $single_image_classe_string = implode(' ', $single_image_classes); $style = grve_osmosis_vce_build_margin_bottom_style($margin_bottom); $output .= '<div class="' . esc_attr($single_image_classe_string) . '" style="' . $style . '"' . $data . '>'; if (!empty($image)) { $id = preg_replace('/[^\\d]/', '', $image); $image_link_href = wp_get_attachment_url($id); $thumb_src = wp_get_attachment_image_src($id, 'full'); $image_dimensions = 'width="' . $thumb_src[1] . '" height="' . $thumb_src[2] . '"'; $full_src = wp_get_attachment_image_src($id, 'large'); if (!empty($retina_image)) { $img_retina_id = preg_replace('/[^\\d]/', '', $retina_image); $img_retina_src = wp_get_attachment_image_src($img_retina_id, 'full'); $retina_data = ' data-at2x="' . esc_attr($img_retina_src[0]) . '"'; } $alt = get_post_meta($id, '_wp_attachment_image_alt', true); $alt = !empty($alt) ? esc_attr($alt) : ''; if ('image-popup' == $image_type) { $output .= '<a class="grve-image-popup" href="' . esc_url($full_src[0]) . '">'; $output .= ' <img alt="' . $alt . '" src="' . esc_url($thumb_src[0]) . '" ' . $image_dimensions . $retina_data . '>'; $output .= '</a>'; } else { if ('image-link' == $image_type) { $output .= '<a href="' . esc_url($url) . '" target="' . $target . '">'; $output .= ' <img alt="' . $alt . '" src="' . esc_url($thumb_src[0]) . '" ' . $image_dimensions . $retina_data . '>'; $output .= '</a>'; } else { if ('image-video-popup' == $image_type) { if (!empty($video_link)) { $output .= '<div class="grve-media">'; $output .= ' <a class="grve-vimeo-popup grve-icon-video" href="' . esc_url($video_link) . '">'; $output .= ' <img alt="' . $alt . '" src="' . esc_url($thumb_src[0]) . '" ' . $image_dimensions . $retina_data . '>'; $output .= ' </a>'; $output .= '</div>'; } else { $output .= '<div class="grve-media">'; $output .= ' <img alt="' . $alt . '" src="' . esc_url($thumb_src[0]) . '" ' . $image_dimensions . $retina_data . '>'; $output .= '</div>'; } } else { $output .= ' <img alt="' . $alt . '" src="' . esc_url($thumb_src[0]) . '" ' . $image_dimensions . $retina_data . '>'; } } } } $output .= '</div>'; return $output; }
function grve_icon_box_shortcode($atts, $content) { $output = $link_start = $link_end = $retina_data = $text_style_class = $data = $el_class = ''; extract(shortcode_atts(array('title' => '', 'icon' => '', 'icon_type' => 'icon', 'icon_size' => 'medium', 'icon_shape' => 'no-shape', 'shape_type' => 'simple', 'icon_color' => 'primary-1', 'icon_animation' => 'no', 'icon_char' => '', 'icon_image' => '', 'retina_icon_image' => '', 'align' => 'left', 'text_style' => 'none', 'link' => '', 'animation' => '', 'animation_delay' => '200', 'margin_bottom' => '', 'el_class' => ''), $atts)); $icon_box_classes = array('grve-element'); array_push($icon_box_classes, 'grve-box-icon'); array_push($icon_box_classes, 'grve-align-' . $align); if (!empty($animation)) { array_push($icon_box_classes, 'grve-animated-item'); array_push($icon_box_classes, $animation); $data = ' data-delay="' . esc_attr($animation_delay) . '"'; } if ('yes' == $icon_animation) { array_push($icon_box_classes, 'grve-advanced-hover'); } if (!empty($el_class)) { array_push($icon_box_classes, $el_class); } $icon_box_class_string = implode(' ', $icon_box_classes); $icon_classes = array('grve-icon'); array_push($icon_classes, 'grve-' . $icon_size); array_push($icon_classes, 'grve-' . $shape_type); array_push($icon_classes, 'grve-' . $icon_shape); if ('no-shape' != $icon_shape && 'outline' != $shape_type) { array_push($icon_classes, 'grve-bg-' . $icon_color); } else { array_push($icon_classes, 'grve-color-' . $icon_color); } if ('icon' == $icon_type) { array_push($icon_classes, 'fa fa-' . $icon); } if ('image' == $icon_type) { array_push($icon_classes, 'grve-image-icon'); } $icon_class_string = implode(' ', $icon_classes); if (!empty($link)) { $href = vc_build_link($link); $url = $href['url']; if (!empty($href['target'])) { $target = $href['target']; } else { $target = "_self"; } } else { $url = "#"; $target = "_self"; } if (!empty($url) && '#' != $url) { $link_start = '<a href="' . esc_url($url) . '" target="' . $target . '">'; $link_end = '</a>'; } // Paragraph if ('none' != $text_style) { $text_style_class = 'grve-' . $text_style; } $style = grve_osmosis_vce_build_margin_bottom_style($margin_bottom); $output .= '<div class="' . esc_attr($icon_box_class_string) . '" style="' . $style . '"' . $data . '>'; $output .= $link_start; if ('image' == $icon_type) { if (!empty($icon_image)) { $img_id = preg_replace('/[^\\d]/', '', $icon_image); $img_src = wp_get_attachment_image_src($img_id, 'full'); $image_dimensions = 'width="' . $img_src[1] . '" height="' . $img_src[2] . '"'; if (!empty($retina_icon_image)) { $img_retina_id = preg_replace('/[^\\d]/', '', $retina_icon_image); $img_retina_src = wp_get_attachment_image_src($img_retina_id, 'full'); $retina_data = ' data-at2x="' . esc_attr($img_retina_src[0]) . '"'; } $output .= ' <div class="' . esc_attr($icon_class_string) . '"><img alt="icon" src="' . esc_url($img_src[0]) . '"' . $retina_data . ' ' . $image_dimensions . '></div>'; } } else { if ('char' == $icon_type) { $output .= ' <div class="' . esc_attr($icon_class_string) . '">' . $icon_char . '</div>'; } else { $output .= ' <div class="' . esc_attr($icon_class_string) . '"></div>'; } } $output .= $link_end; $output .= ' <div class="grve-box-content">'; if (!empty($title)) { $output .= $link_start; $output .= ' <h5 class="grve-box-title">' . $title . '</h5>'; $output .= $link_end; } if (!empty($content)) { $output .= ' <p class="' . esc_attr($text_style_class) . '">' . $content . '</p>'; } $output .= ' </div>'; $output .= '</div>'; return $output; }
function grve_media_box_shortcode($atts, $content) { global $wp_embed; $output = $data = $retina_data = $el_class = ''; extract(shortcode_atts(array('title' => '', 'media_type' => 'image', 'image' => '', 'retina_image' => '', 'video_popup' => '', 'video_link' => '', 'map_lat' => '51.516221', 'map_lng' => '-0.136986', 'map_height' => '280', 'map_marker' => '', 'map_zoom' => 14, 'title_link' => '', 'read_more_title' => '', 'align' => 'left', 'animation' => '', 'animation_delay' => '200', 'margin_bottom' => '', 'el_class' => ''), $atts)); if (!empty($title_link)) { $href = vc_build_link($title_link); $url = $href['url']; if (!empty($href['target'])) { $target = $href['target']; } else { $target = "_self"; } } else { $url = "#"; $target = "_self"; } $media_box_classes = array('grve-element', 'grve-box', 'grve-align-' . $align); if (!empty($animation)) { array_push($media_box_classes, 'grve-animated-item'); array_push($media_box_classes, $animation); $data = ' data-delay="' . esc_attr($animation_delay) . '"'; } if (!empty($el_class)) { array_push($media_box_classes, $el_class); } $media_box_classe_string = implode(' ', $media_box_classes); $style = grve_osmosis_vce_build_margin_bottom_style($margin_bottom); $output .= '<div class="' . esc_attr($media_box_classe_string) . '" style="' . $style . '"' . $data . '>'; switch ($media_type) { case 'image': case 'image-video-popup': if (!empty($image)) { $img_id = preg_replace('/[^\\d]/', '', $image); $img_src = wp_get_attachment_image_src($img_id, 'full'); $image_dimensions = 'width="' . $img_src[1] . '" height="' . $img_src[2] . '"'; if (!empty($retina_image)) { $img_retina_id = preg_replace('/[^\\d]/', '', $retina_image); $img_retina_src = wp_get_attachment_image_src($img_retina_id, 'full'); $retina_data = ' data-at2x="' . esc_attr($img_retina_src[0]) . '"'; } $alt = get_post_meta($img_id, '_wp_attachment_image_alt', true); $alt = !empty($alt) ? esc_attr($alt) : ''; if ('image-video-popup' == $media_type && !empty($video_link)) { $output .= '<div class="grve-media">'; $output .= ' <a class="grve-vimeo-popup grve-icon-video" href="' . $video_link . '">'; $output .= ' <img alt="' . $alt . '" src="' . esc_url($img_src[0]) . '" ' . $image_dimensions . $retina_data . '>'; $output .= ' </a>'; $output .= '</div>'; } else { $output .= '<div class="grve-media">'; $output .= ' <img alt="' . $alt . '" src="' . esc_url($img_src[0]) . '" ' . $image_dimensions . $retina_data . '>'; $output .= '</div>'; } } break; case 'video': if (!empty($video_link)) { $output .= '<div class="grve-media">'; $output .= $wp_embed->run_shortcode('[embed]' . $video_link . '[/embed]'); $output .= '</div>'; } break; case 'map': wp_enqueue_script('grve-googleapi-script'); wp_enqueue_script('grve-maps-script'); if (empty($map_marker)) { $map_marker = get_template_directory_uri() . '/images/markers/markers.png'; } else { $id = preg_replace('/[^\\d]/', '', $map_marker); $full_src = wp_get_attachment_image_src($id, 'full'); $map_marker = $full_src[0]; } $map_title = ''; $data_map = 'data-lat="' . esc_attr($map_lat) . '" data-lng="' . esc_attr($map_lng) . '" data-zoom="' . esc_attr($map_zoom) . '"'; $output .= '<div class="grve-media">'; $output .= ' <div class="grve-map" ' . $data_map . ' style="' . $style . grve_osmosis_vce_build_dimension('height', $map_height) . '"></div>'; $output .= ' <div style="display:none" class="grve-map-point" data-point-lat="' . esc_attr($map_lat) . '" data-point-lng="' . esc_attr($map_lng) . '" data-point-marker="' . esc_attr($map_marker) . '" data-point-title="' . esc_attr($map_title) . '"></div>'; $output .= '</div>'; break; default: break; } $output .= ' <div class="grve-box-content">'; if (!empty($title_link)) { $output .= ' <a href="' . esc_url($url) . '" target="' . $target . '">'; } $output .= ' <h5 class="grve-box-title">' . $title . '</h5>'; if (!empty($title_link)) { $output .= ' </a>'; } $output .= ' <p>' . $content . '</p>'; if (!empty($read_more_title) && !empty($url)) { $output .= ' <a href="' . esc_url($url) . '" target="' . $target . '" class="grve-read-more">'; $output .= $read_more_title; $output .= '</a>'; } $output .= ' </div>'; $output .= '</div>'; return $output; }
function grve_slider_shortcode($attr, $content) { $output = $class_fullwidth = $el_class = ''; extract(shortcode_atts(array('ids' => '', 'image_mode' => 'resize', 'slideshow_speed' => '3500', 'navigation_type' => '1', 'navigation_color' => 'light', 'image_custom_title' => 'default', 'hide_image_title' => '', 'hide_image_caption' => '', 'custom_title' => '', 'custom_caption' => '', 'title_color' => 'dark', 'custom_title_align' => 'left', 'custom_title_line_type' => 'no-line', 'pause_hover' => 'no', 'auto_play' => 'yes', 'auto_height' => 'no', 'margin_bottom' => '', 'zoom_effect' => 'in', 'overlay_color' => 'dark', 'overlay_opacity' => '60', 'el_class' => ''), $attr)); $attachments = explode(",", $ids); if (empty($attachments)) { return ''; } $image_size = 'grve-image-fullscreen'; if ('autocrop' == $image_mode) { $image_size = 'grve-image-large-rect-horizontal'; } $style = grve_osmosis_vce_build_margin_bottom_style($margin_bottom); $slider_data = ''; $slider_data .= ' data-slider-speed="' . esc_attr($slideshow_speed) . '"'; $slider_data .= ' data-slider-pause="' . esc_attr($pause_hover) . '"'; $slider_data .= ' data-navigation-type="' . esc_attr($navigation_type) . '"'; $slider_data .= ' data-slider-autoplay="' . esc_attr($auto_play) . '"'; $slider_data .= ' data-slider-autoheight="' . esc_attr($auto_height) . '"'; $output .= '<div class="grve-element grve-carousel-wrapper" style="' . $style . ' ">'; if (0 != $navigation_type) { $output .= '<div class="grve-carousel-navigation grve-' . esc_attr($navigation_color) . '" data-navigation-type="' . esc_attr($navigation_type) . '">'; $output .= ' <div class="grve-carousel-buttons">'; $output .= ' <div class="grve-carousel-prev grve-icon-nav-left"></div>'; $output .= ' <div class="grve-carousel-next grve-icon-nav-right"></div>'; $output .= ' </div>'; $output .= '</div>'; } // Custom Title if ('default' != $image_custom_title) { $output .= '<div class="grve-custom-title-wrapper">'; $output .= ' <div class="grve-custom-title-content grve-align-' . esc_attr($custom_title_align) . ' grve-' . esc_attr($title_color) . '">'; if (!empty($custom_title)) { $output .= ' <h3 class="grve-title grve-title-' . esc_attr($custom_title_line_type) . '"><span>' . $custom_title . '</span></h3>'; } if (!empty($custom_caption)) { $output .= ' <div class="grve-caption">' . $custom_caption . '</div>'; } $output .= ' </div>'; $output .= '</div>'; } $output .= '<div class="grve-slider grve-carousel-element ' . esc_attr($el_class) . '"' . $slider_data . '>'; foreach ($attachments as $id) { $image_link_href = wp_get_attachment_url($id); $thumb_src = wp_get_attachment_image_src($id, $image_size); $image_dimensions = 'width="' . $thumb_src[1] . '" height="' . $thumb_src[2] . '"'; $image_title = get_post_field('post_title', $id); $caption = get_post_field('post_excerpt', $id); $alt = get_post_meta($id, '_wp_attachment_image_alt', true); $alt = !empty($alt) ? esc_attr($alt) : wptexturize($image_title); $output .= '<div class="grve-slider-item">'; $output .= ' <figure class="grve-image-hover grve-zoom-' . esc_attr($zoom_effect) . '">'; $output .= ' <div class="grve-media grve-' . esc_attr($overlay_color) . '-overlay grve-opacity-' . esc_attr($overlay_opacity) . '">'; $output .= ' <img src="' . esc_url($thumb_src[0]) . '" alt="' . $alt . '" ' . $image_dimensions . '>'; $output .= ' </div>'; if ('custom-title' != $image_custom_title) { $output .= '<figcaption>'; if (!empty($image_title) && 'yes' != $hide_image_title) { $output .= '<h6 class="grve-title grve-' . esc_attr($overlay_color) . '">' . wptexturize($image_title) . '</h6>'; } if (!empty($caption) && 'yes' != $hide_image_caption) { $output .= '<span class="grve-caption grve-' . esc_attr($overlay_color) . '">' . wptexturize($caption) . '</span>'; } $output .= '</figcaption>'; } $output .= ' </figure>'; $output .= '</div>'; } $output .= ' </div>'; $output .= '</div>'; return $output; }