This commit is contained in:
nguyen dung
2022-02-18 16:43:41 +07:00
commit 39b8cb3612
4470 changed files with 1378320 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
<?php
/**
* Accordion Shortcode
*
* Accordion and Accordion Item Shortcode builder.
*
* @author UX Themes
* @package Flatsome/Shortcodes/Accordion
* @version 3.9.0
*/
/**
* Output the accordion shortcode.
*
* @param array $atts Shortcode attributes.
* @param string $content Accordion content.
*
* @return string.
*/
function ux_accordion( $atts, $content = null ) {
extract(shortcode_atts(array(
'auto_open' => '',
'open' => '',
'title' => '',
'class' => '',
), $atts));
if ($auto_open) $open = 1;
$classes = array( 'accordion' );
if ( $class ) $classes[] = $class;
if ($title) $title = '<h3 class="accordion_title">' . $title . '</h3>';
return $title . '<div class="' . implode( ' ', $classes ) . '" rel="' . $open . '">' . do_shortcode( $content ) . '</div>';
}
add_shortcode( 'accordion', 'ux_accordion' );
/**
* Output the accordion-item shortcode.
*
* @param array $atts Shortcode attributes.
* @param string $content Accordion content.
*
* @return string.
*/
function ux_accordion_item( $atts, $content = null ) {
extract(shortcode_atts(array(
'title' => 'Accordion Panel',
'class' => '',
), $atts));
$classes = array( 'accordion-item' );
if ( $class ) $classes[] = $class;
return '<div class="' . implode( ' ', $classes ) . '"><a href="#" class="accordion-title plain"><button class="toggle"><i class="icon-angle-down"></i></button><span>' . $title . '</span></a><div class="accordion-inner">' . do_shortcode( $content ) . '</div></div>';
}
add_shortcode( 'accordion-item', 'ux_accordion_item' );

View File

@@ -0,0 +1,320 @@
<?php
// [blog_posts]
function shortcode_latest_from_blog($atts, $content = null, $tag = '' ) {
extract(shortcode_atts(array(
"_id" => 'row-'.rand(),
'style' => '',
'class' => '',
'visibility' => '',
// Layout
"columns" => '4',
"columns__sm" => '1',
"columns__md" => '',
'col_spacing' => '',
"type" => 'slider', // slider, row, masonery, grid
'width' => '',
'grid' => '1',
'grid_height' => '600px',
'grid_height__md' => '500px',
'grid_height__sm' => '400px',
'slider_nav_style' => 'reveal',
'slider_nav_position' => '',
'slider_nav_color' => '',
'slider_bullets' => 'false',
'slider_arrows' => 'true',
'auto_slide' => 'false',
'infinitive' => 'true',
'depth' => '',
'depth_hover' => '',
// posts
'posts' => '8',
'ids' => false, // Custom IDs
'cat' => '',
'category' => '', // Added for Flatsome v2 fallback
'excerpt' => 'visible',
'excerpt_length' => 15,
'offset' => '',
'orderby' => 'date',
'order' => 'DESC',
// Read more
'readmore' => '',
'readmore_color' => '',
'readmore_style' => 'outline',
'readmore_size' => 'small',
// div meta
'post_icon' => 'true',
'comments' => 'true',
'show_date' => 'badge', // badge, text
'badge_style' => '',
'show_category' => 'false',
//Title
'title_size' => 'large',
'title_style' => '',
// Box styles
'animate' => '',
'text_pos' => 'bottom',
'text_padding' => '',
'text_bg' => '',
'text_size' => '',
'text_color' => '',
'text_hover' => '',
'text_align' => 'center',
'image_size' => 'medium',
'image_width' => '',
'image_radius' => '',
'image_height' => '56%',
'image_hover' => '',
'image_hover_alt' => '',
'image_overlay' => '',
'image_depth' => '',
'image_depth_hover' => '',
), $atts));
// Stop if visibility is hidden
if($visibility == 'hidden') return;
ob_start();
$classes_box = array();
$classes_image = array();
$classes_text = array();
// Fix overlay color
if($style == 'text-overlay'){
$image_hover = 'zoom';
}
$style = str_replace('text-', '', $style);
// Fix grids
if($type == 'grid'){
if(!$text_pos) $text_pos = 'center';
$columns = 0;
$current_grid = 0;
$grid = flatsome_get_grid($grid);
$grid_total = count($grid);
flatsome_get_grid_height($grid_height, $_id);
}
// Fix overlay
if($style == 'overlay' && !$image_overlay) $image_overlay = 'rgba(0,0,0,.25)';
// Set box style
if($style) $classes_box[] = 'box-'.$style;
if($style == 'overlay') $classes_box[] = 'dark';
if($style == 'shade') $classes_box[] = 'dark';
if($style == 'badge') $classes_box[] = 'hover-dark';
if($text_pos) $classes_box[] = 'box-text-'.$text_pos;
if($image_hover) $classes_image[] = 'image-'.$image_hover;
if($image_hover_alt) $classes_image[] = 'image-'.$image_hover_alt;
if($image_height) $classes_image[] = 'image-cover';
// Text classes
if($text_hover) $classes_text[] = 'show-on-hover hover-'.$text_hover;
if($text_align) $classes_text[] = 'text-'.$text_align;
if($text_size) $classes_text[] = 'is-'.$text_size;
if($text_color == 'dark') $classes_text[] = 'dark';
$css_args_img = array(
array( 'attribute' => 'border-radius', 'value' => $image_radius, 'unit' => '%' ),
array( 'attribute' => 'width', 'value' => $image_width, 'unit' => '%' ),
);
$css_image_height = array(
array( 'attribute' => 'padding-top', 'value' => $image_height),
);
$css_args = array(
array( 'attribute' => 'background-color', 'value' => $text_bg ),
array( 'attribute' => 'padding', 'value' => $text_padding ),
);
// Add Animations
if($animate) {$animate = 'data-animate="'.$animate.'"';}
$classes_text = implode(' ', $classes_text);
$classes_image = implode(' ', $classes_image);
$classes_box = implode(' ', $classes_box);
// Repeater styles
$repeater['id'] = $_id;
$repeater['tag'] = $tag;
$repeater['type'] = $type;
$repeater['class'] = $class;
$repeater['visibility'] = $visibility;
$repeater['style'] = $style;
$repeater['slider_style'] = $slider_nav_style;
$repeater['slider_nav_position'] = $slider_nav_position;
$repeater['slider_nav_color'] = $slider_nav_color;
$repeater['slider_bullets'] = $slider_bullets;
$repeater['auto_slide'] = $auto_slide;
$repeater['infinitive'] = $infinitive;
$repeater['row_spacing'] = $col_spacing;
$repeater['row_width'] = $width;
$repeater['columns'] = $columns;
$repeater['columns__md'] = $columns__md;
$repeater['columns__sm'] = $columns__sm;
$repeater['depth'] = $depth;
$repeater['depth_hover'] = $depth_hover;
$args = array(
'post_status' => 'publish',
'post_type' => 'post',
'offset' => $offset,
'cat' => $cat,
'posts_per_page' => $posts,
'ignore_sticky_posts' => true,
'orderby' => $orderby,
'order' => $order,
);
// Added for Flatsome v2 fallback
if ( get_theme_mod('flatsome_fallback', 0) && $category ) {
$args['category_name'] = $category;
}
// If custom ids
if ( !empty( $ids ) ) {
$ids = explode( ',', $ids );
$ids = array_map( 'trim', $ids );
$args = array(
'post__in' => $ids,
'post_type' => array(
'post',
'featured_item', // Include for its tag archive listing.
),
'numberposts' => -1,
'orderby' => 'post__in',
'posts_per_page' => 9999,
'ignore_sticky_posts' => true,
);
}
$recentPosts = new WP_Query( $args );
// Get repeater HTML.
get_flatsome_repeater_start($repeater);
while ( $recentPosts->have_posts() ) : $recentPosts->the_post();
$col_class = array( 'post-item' );
$show_excerpt = $excerpt;
if(get_post_format() == 'video') $col_class[] = 'has-post-icon';
if($type == 'grid'){
if($grid_total > $current_grid) $current_grid++;
$current = $current_grid-1;
$col_class[] = 'grid-col';
if($grid[$current]['height']) $col_class[] = 'grid-col-'.$grid[$current]['height'];
if($grid[$current]['span']) $col_class[] = 'large-'.$grid[$current]['span'];
if($grid[$current]['md']) $col_class[] = 'medium-'.$grid[$current]['md'];
// Set image size
if($grid[$current]['size']) $image_size = $grid[$current]['size'];
// Hide excerpt for small sizes
if($grid[$current]['size'] == 'thumbnail') $show_excerpt = 'false';
}
?><div class="col <?php echo implode(' ', $col_class); ?>" <?php echo $animate;?>>
<div class="col-inner">
<a href="<?php the_permalink() ?>" class="plain">
<div class="box <?php echo $classes_box; ?> box-blog-post has-hover">
<?php if(has_post_thumbnail()) { ?>
<div class="box-image" <?php echo get_shortcode_inline_css($css_args_img); ?>>
<div class="<?php echo $classes_image; ?>" <?php echo get_shortcode_inline_css($css_image_height); ?>>
<?php the_post_thumbnail($image_size); ?>
<?php if($image_overlay){ ?><div class="overlay" style="background-color: <?php echo $image_overlay;?>"></div><?php } ?>
<?php if($style == 'shade'){ ?><div class="shade"></div><?php } ?>
</div>
<?php if($post_icon && get_post_format()) { ?>
<div class="absolute no-click x50 y50 md-x50 md-y50 lg-x50 lg-y50">
<div class="overlay-icon">
<i class="icon-play"></i>
</div>
</div>
<?php } ?>
</div>
<?php } ?>
<div class="box-text <?php echo $classes_text; ?>" <?php echo get_shortcode_inline_css($css_args); ?>>
<div class="box-text-inner blog-post-inner">
<?php do_action('flatsome_blog_post_before'); ?>
<?php if($show_category !== 'false') { ?>
<p class="cat-label <?php if($show_category == 'label') echo 'tag-label'; ?> is-xxsmall op-7 uppercase">
<?php
foreach((get_the_category()) as $cat) {
echo $cat->cat_name . ' ';
}
?>
</p>
<?php } ?>
<h5 class="post-title is-<?php echo $title_size; ?> <?php echo $title_style;?>"><?php the_title(); ?></h5>
<?php if((!has_post_thumbnail() && $show_date !== 'false') || $show_date == 'text') {?><div class="post-meta is-small op-8"><?php echo get_the_date(); ?></div><?php } ?>
<div class="is-divider"></div>
<?php if($show_excerpt !== 'false') { ?>
<p class="from_the_blog_excerpt <?php if($show_excerpt !== 'visible'){ echo 'show-on-hover hover-'.$show_excerpt; } ?>"><?php
$the_excerpt = get_the_excerpt();
$excerpt_more = apply_filters( 'excerpt_more', ' [...]' );
echo flatsome_string_limit_words($the_excerpt, $excerpt_length) . $excerpt_more;
?>
</p>
<?php } ?>
<?php if ( $comments == 'true' && comments_open() && '0' != get_comments_number() ) { ?>
<p class="from_the_blog_comments uppercase is-xsmall">
<?php
$comments_number = get_comments_number( get_the_ID() );
/* translators: %s: comment count */
printf( _n( '%s Comment', '%s Comments', $comments_number, 'flatsome' ),
number_format_i18n( $comments_number ) )
?>
</p>
<?php } ?>
<?php if($readmore) { ?>
<button href="<?php echo get_the_permalink(); ?>" class="button <?php echo $readmore_color; ?> is-<?php echo $readmore_style; ?> is-<?php echo $readmore_size; ?> mb-0">
<?php echo $readmore ;?>
</button>
<?php } ?>
<?php do_action('flatsome_blog_post_after'); ?>
</div>
</div>
<?php if(has_post_thumbnail() && ($show_date == 'badge' || $show_date == 'true')) {?>
<?php if(!$badge_style) $badge_style = get_theme_mod('blog_badge_style', 'outline'); ?>
<div class="badge absolute top post-date badge-<?php echo $badge_style; ?>">
<div class="badge-inner">
<span class="post-date-day"><?php echo get_the_time('d', get_the_ID()); ?></span><br>
<span class="post-date-month is-xsmall"><?php echo get_the_time('M', get_the_ID()); ?></span>
</div>
</div>
<?php } ?>
</div>
</a>
</div>
</div><?php endwhile;
wp_reset_query();
// Get repeater end.
get_flatsome_repeater_end($atts);
$content = ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode("blog_posts", "shortcode_latest_from_blog");

View File

@@ -0,0 +1,210 @@
<?php
/**
* [button]
*/
function button_shortcode( $atts, $content = null ) {
extract( shortcode_atts( array(
'text' => '',
'style' => '',
'color' => 'primary',
'size' => '',
'animate' => '',
'link' => '',
'target' => '_self',
'rel' => '',
'border' => '',
'expand' => '',
'tooltip' => '',
'padding' => '',
'radius' => '',
'letter_case' => '',
'mobile_icon' => '',
'icon' => '',
'icon_pos' => '',
'icon_reveal' => '',
'depth' => '',
'depth_hover' => '',
'class' => '',
'visibility' => '',
'id' => '',
'block' => '',
), $atts ) );
// Old button Fallback.
if ( strpos( $style, 'primary' ) !== false ) {
$color = 'primary';
} elseif ( strpos( $style, 'secondary' ) !== false ) {
$color = 'secondary';
} elseif ( strpos( $style, 'white' ) !== false ) {
$color = 'white';
} elseif ( strpos( $style, 'success' ) !== false ) {
$color = 'success';
} elseif ( strpos( $style, 'alert' ) !== false ) {
$color = 'alert';
}
if ( strpos( $style, 'alt-button' ) !== false ) {
$style = 'outline';
}
$attributes = array();
$icon_left = $icon && $icon_pos == 'left' ? get_flatsome_icon( $icon ) : '';
$icon_right = $icon && $icon_pos !== 'left' ? get_flatsome_icon( $icon ) : '';
// Add Button Classes.
$classes = array();
$classes[] = 'button';
if ( $color ) {
$classes[] = $color;
}
if ( $style ) {
$classes[] = 'is-' . $style;
}
if ( $size ) {
$classes[] = 'is-' . $size;
}
if ( $depth ) {
$classes[] = 'box-shadow-' . $depth;
}
if ( $depth_hover ) {
$classes[] = 'box-shadow-' . $depth_hover . '-hover';
}
if ( $letter_case ) {
$classes[] = $letter_case;
}
if ( $icon_reveal ) {
$classes[] = 'reveal-icon';
}
if ( $expand ) {
$classes[] = 'expand';
}
if ( $class ) {
$classes[] = $class;
}
if ( $visibility ) {
$classes[] = $visibility;
}
if ( $animate ) {
$attributes['data-animate'] = $animate;
}
if ( $target == '_blank' ) {
$attributes['rel'][] = 'noopener noreferrer';
}
if ( $rel ) {
$attributes['rel'][] = $rel;
}
if ( $link ) {
// Smart links.
$link = flatsome_smart_links( $link );
$attributes['href'] = $link;
if ( $target ) {
$attributes['target'] = $target;
}
}
if ( $tooltip ) {
$classes[] = 'has-tooltip';
$attributes['title'] = $tooltip;
}
$styles = get_shortcode_inline_css( array(
array(
'unit' => 'px',
'attribute' => 'border-radius',
'value' => intval( $radius ),
),
array(
'unit' => 'px',
'attribute' => 'border-width',
'value' => intval( $border ),
),
array(
'attribute' => 'padding',
'value' => $padding,
),
) );
$attributes['class'] = $classes;
$attributes = flatsome_html_atts( $attributes );
// Template is located in template-parts/shortcodes.
return flatsome_template( 'shortcodes/button', get_defined_vars() );
}
add_shortcode( 'button', 'button_shortcode' );
/**
* [facebook_login_button]
*/
function facebook_login_shortcode( $atts, $content = null ) {
extract( shortcode_atts( array(
'text' => 'Login / Register with Facebook',
'size' => 'medium',
), $atts ) );
ob_start();
$facebook_url = add_query_arg( array( 'loginSocial' => 'facebook' ), wp_login_url() );
?>
<a href="<?php echo esc_url( $facebook_url ); ?>" class="button <?php echo esc_attr( $size ); ?> facebook-button" data-plugin="nsl" data-action="connect" data-redirect="current" data-provider="facebook" data-popupwidth="475" data-popupheight="175">
<?php echo get_flatsome_icon( 'icon-facebook' ); ?>
<?php echo $text; ?>
</a>
<?php
$content = ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode( 'facebook_login_button', 'facebook_login_shortcode' );
/**
* Phone button
*/
function ux_phone( $atts, $content = null ) {
extract( shortcode_atts( array(
'number' => '+000 000 000',
'tooltip' => '',
'border' => '2px',
), $atts ) );
return do_shortcode( '<div class="header-button">[button style="outline" class="circle" icon="icon-phone" color=" " icon_pos="left" text="' . $number . '" link="tel:' . $number . '" tooltip="' . $tooltip . '" border="' . $border . '"]</div>' );
}
add_shortcode( 'phone', 'ux_phone' );
/**
* Header button
*/
function ux_header_button( $atts, $content = null ) {
extract( shortcode_atts( array(
'text' => 'Order Now',
'link' => '',
'tooltip' => '',
'border' => '2px',
'target' => '_self',
), $atts ) );
return do_shortcode( '<div class="header-button">[button style="outline" class="circle" color=" " text="' . $text . '" link="' . $link . '" target="' . $target . '" tooltip="' . $tooltip . '" border="' . $border . '"]</div>' );
}
add_shortcode( 'header_button', 'ux_header_button' );
function ux_video_button( $atts, $content = null ) {
extract( shortcode_atts( array(
'video' => 'https://www.youtube.com/watch?v=f3Hh_qSkpaA',
'size' => '',
), $atts ) );
if ( $size ) {
$size = 'style="font-size:' . $size . '%"';
}
return '<div class="video-button-wrapper" ' . $size . '><a href="' . $video . '" class="button open-video icon circle is-outline is-xlarge">' . get_flatsome_icon( 'icon-play', '1.5em' ) . '</a></div>';
}
add_shortcode( 'video_button', 'ux_video_button' );

View File

@@ -0,0 +1,19 @@
<?php
$border_class = array('is-border');
if($border_style) $border_class[] = 'is-'.$border_style;
if(isset($border_hover) && $border_hover) $border_class[] = 'hover-'.$border_hover;
$border_style = array(
array( 'attribute' => 'border-color', 'value' => $border_color ),
array( 'attribute' => 'border-radius', 'value' => $border_radius, 'unit' => 'px' ),
array( 'attribute' => 'border-width', 'value' => $border ),
array( 'attribute' => 'margin', 'value' => $border_margin ),
);
?>
<?php if($border) { ?>
<div class="<?php echo implode(' ', $border_class); ?>"
<?php echo get_shortcode_inline_css($border_style); ?>>
</div>
<?php } ?>

View File

@@ -0,0 +1,31 @@
<?php // phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
if ( $atts['divider_top'] ) :
$classes_divider_top = array(
'ux-shape-divider',
'ux-shape-divider--top',
'ux-shape-divider--style-' . $atts['divider_top'],
);
if ( $atts['divider_top_flip'] === 'true' ) $classes_divider_top[] = 'ux-shape-divider--flip';
if ( $atts['divider_top_to_front'] === 'true' ) $classes_divider_top[] = 'ux-shape-divider--to-front';
?>
<div class="<?php echo esc_attr( implode( ' ', $classes_divider_top ) ); ?>">
<?php echo file_get_contents( get_template_directory() . '/assets/img/dividers/' . $atts['divider_top'] . '.svg' ); // phpcs:ignore WordPress.WP.AlternativeFunctions, WordPress.Security.EscapeOutput ?>
</div>
<?php endif; ?>
<?php
if ( $atts['divider'] ) :
$classes_divider = array(
'ux-shape-divider',
'ux-shape-divider--bottom',
'ux-shape-divider--style-' . $atts['divider'],
);
if ( $atts['divider_flip'] === 'true' ) $classes_divider[] = 'ux-shape-divider--flip';
if ( $atts['divider_to_front'] === 'true' ) $classes_divider[] = 'ux-shape-divider--to-front';
?>
<div class="<?php echo esc_attr( implode( ' ', $classes_divider ) ); ?>">
<?php echo file_get_contents( get_template_directory() . '/assets/img/dividers/' . $atts['divider'] . '.svg' ); // phpcs:ignore WordPress.WP.AlternativeFunctions, WordPress.Security.EscapeOutput ?>
</div>
<?php endif; // phpcs:enable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable ?>

View File

@@ -0,0 +1,16 @@
<?php if ( $video_mp4 || $video_webm || $video_ogg ) { ?>
<div class="video-overlay no-click fill <?php echo $video_visibility; ?>"></div>
<video class="video-bg fill <?php echo $video_visibility; ?>" preload playsinline autoplay
<?php echo $video_sound == 'false' ? 'muted' : ''; ?>
<?php echo $video_loop == 'false' ? '' : 'loop'; ?>>
<?php
echo $video_mp4 ? '<source src="' . $video_mp4 . '" type="video/mp4">' : '';
echo $video_ogg ? '<source src="' . $video_ogg . '" type="video/ogg">' : '';
echo $video_webm ? '<source src="' . $video_webm . '" type="video/webm">' : '';
?>
</video>
<?php } ?>
<?php if ( $youtube ) { ?>
<div class="video-overlay no-click fill"></div>
<div id="ytplayer-<?php echo mt_rand( 1, 1000 ); ?>" class="ux-youtube fill object-fit <?php echo $video_visibility; ?>" data-videoid="<?php echo $youtube; ?>" data-loop="<?php echo 'false' !== $video_loop ? '1' : '0'; ?>" data-audio="<?php echo 'false' === $video_sound ? '0' : '1'; ?>"></div>
<?php } ?>

View File

@@ -0,0 +1,294 @@
<?php
add_shortcode( 'ux_product_gallery', function ( $atts ) {
extract( shortcode_atts( array(
'style' => 'normal',
), $atts ) );
if ( ! is_product() ) {
return null;
}
add_filter( 'theme_mod_product_image_style', function () use ( $style ) {
return $style;
} );
add_filter( 'theme_mod_product_layout', function () use ( $style ) {
$layout = '';
if ( $style === 'full-width' ) $layout = 'gallery-wide';
if ( $style === 'stacked' ) $layout = 'stacked-right';
return $layout;
} );
ob_start();
wc_get_template_part( 'single-product/product-image' );
return ob_get_clean();
} );
add_shortcode( 'ux_product_title', function ( $atts ) {
extract( shortcode_atts( array(
'size' => false,
'divider' => true,
'case' => 'normal',
'uppercase' => false,
), $atts ) );
if ( ! is_product() ) {
return null;
}
add_filter( 'theme_mod_product_title_divider', function ( $input ) use ( $divider ) {
if ( $divider ) {
return true;
}
} );
$classes = array( 'product-title-container' );
if ( $size ) {
$classes[] = 'is-' . $size;
}
if ( $uppercase ) {
$classes[] = 'is-uppercase';
}
ob_start();
echo '<div class="' . implode( ' ', $classes ) . '">';
woocommerce_template_single_title();
echo '</div>';
return ob_get_clean();
} );
add_shortcode( 'ux_product_rating', function ( $atts ) {
extract( shortcode_atts( array(
'size' => 'normal',
'count' => false,
'style' => 'inline',
), $atts ) );
if ( ! is_product() ) {
return null;
}
add_filter( 'theme_mod_product_info_review_count', function () use ( $count ) {
return $count;
} );
add_filter( 'theme_mod_product_info_review_count_style', function () use ( $style ) {
return $style;
} );
ob_start();
woocommerce_template_single_rating();
return ob_get_clean();
} );
add_shortcode( 'ux_product_hook', function ( $atts ) {
extract( shortcode_atts( array(
'hook' => 'woocommerce_single_product_summary',
), $atts ) );
if ( ! is_product() ) {
return null;
}
ob_start();
do_action( $hook );
return ob_get_clean();
} );
add_shortcode( 'ux_product_price', function ( $atts ) {
extract( shortcode_atts( array(
'size' => 'normal',
), $atts ) );
if ( ! is_product() ) {
return null;
}
ob_start();
echo '<div class="product-price-container is-' . $size . '">';
woocommerce_template_single_price();
echo '</div>';
return ob_get_clean();
} );
add_shortcode( 'ux_product_excerpt', function ( $atts ) {
extract( shortcode_atts( array(
'type' => 'default',
), $atts ) );
if ( ! is_product() ) {
return null;
}
ob_start();
woocommerce_template_single_excerpt();
return ob_get_clean();
} );
add_shortcode( 'ux_product_description', function ( $atts ) {
extract( shortcode_atts( array(
'type' => 'default',
), $atts ) );
if ( ! is_product() ) {
return null;
}
ob_start();
the_content();
return ob_get_clean();
} );
add_shortcode( 'ux_product_add_to_cart', function ( $atts ) {
extract( shortcode_atts( array(
'style' => 'normal',
'size' => 'normal',
), $atts ) );
if ( ! is_product() ) {
return null;
}
add_filter( 'theme_mod_product_info_form', function () use ( $style ) {
if ( $style ) {
return $style;
}
} );
ob_start();
echo '<div class="add-to-cart-container form-' . $style . ' is-' . $size . '">';
woocommerce_template_single_add_to_cart();
echo '</div>';
return ob_get_clean();
} );
add_shortcode( 'ux_product_meta', function ( $atts ) {
extract( shortcode_atts( array(
'type' => 'default',
), $atts ) );
if ( ! is_product() ) {
return null;
}
ob_start();
woocommerce_template_single_meta();
return ob_get_clean();
} );
add_shortcode( 'ux_product_tabs', function ( $atts ) {
extract( shortcode_atts( array(
'style' => 'tabs',
'align' => 'left'
), $atts ) );
if ( ! is_product() ) {
return null;
}
add_filter( 'theme_mod_product_display', function ( $input ) use ( $style ) {
if ( $style ) {
return $style;
}
} );
add_filter( 'theme_mod_product_tabs_align', function ( $input ) use ( $align ) {
if ( $align ) {
return $align;
}
} );
ob_start();
wc_get_template_part( 'single-product/tabs/tabs' );
return ob_get_clean();
} );
add_shortcode( 'ux_product_upsell', function ( $atts ) {
extract( shortcode_atts( array(
'style' => 'sidebar',
), $atts ) );
if ( ! is_product() ) {
return null;
}
add_filter( 'theme_mod_product_upsell', function ( $input ) use ( $style ) {
if ( $style ) {
return $style;
}
} );
ob_start();
woocommerce_upsell_display();
return ob_get_clean();
} );
add_shortcode( 'ux_product_related', function ( $atts ) {
extract( shortcode_atts( array(
'style' => 'slider',
), $atts ) );
if ( ! is_product() ) {
return null;
}
add_filter( 'theme_mod_related_products', function ( $input ) use ( $style ) {
if ( $style ) {
return $style;
}
} );
ob_start();
woocommerce_output_related_products();
return ob_get_clean();
} );
add_shortcode( 'ux_product_breadcrumbs', function ( $atts ) {
extract( shortcode_atts( array(
'size' => 'normal',
), $atts ) );
if ( ! is_product() ) {
return null;
}
ob_start();
echo '<div class="product-breadcrumb-container is-' . $size . '">';
flatsome_breadcrumb();
echo '</div>';
return ob_get_clean();
} );
add_shortcode( 'ux_product_next_prev_nav', function ( $atts ) {
$atts = shortcode_atts( array(
'class' => '',
), $atts, 'ux_product_next_prev_nav' );
if ( ! is_product() ) {
return null;
}
ob_start();
flatsome_product_next_prev_nav( $atts['class'] );
return ob_get_clean();
} );

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1,100 @@
<?php
// [featured_box]
function featured_box( $atts, $content = null ) {
extract( shortcode_atts( array(
'title' => '',
'title_small' => '',
'font_size' => '',
'class' => '',
'visibility' => '',
'img' => '',
'inline_svg' => 'true',
'img_width' => '60',
'pos' => 'top',
'link' => '',
'target' => '_self',
'rel' => '',
'tooltip' => '',
'margin' => '',
'icon_border' => '',
'icon_color' => '',
), $atts )
);
if($visibility == 'hidden') return;
$classes = array( 'featured-box' );
$classes_img = array( 'icon-box-img' );
if( $class ) $classes[] = $class;
if( $visibility ) $classes[] = $visibility;
$classes[] = 'icon-box-' . $pos;
if ( $tooltip ) $classes[] = 'tooltip';
if ( $pos == 'center' ) $classes[] = 'text-center';
if ( $pos == 'left' || $pos == 'top' ) $classes[] = 'text-left';
if ( $pos == 'right' ) $classes[] = 'text-right';
if ( $font_size ) $classes[] = 'is-' . $font_size;
if ( $img_width ) $img_width = 'width: ' . intval( $img_width ) . 'px';
if ( $icon_border ) $classes_img[] = 'has-icon-bg';
$css_args_out = array(
'margin' => array(
'attribute' => 'margin',
'value' => $margin,
),
);
$css_args = array(
'icon_border' => array(
'attribute' => 'border-width',
'unit' => 'px',
'value' => $icon_border,
),
'icon_color' => array(
'attribute' => 'color',
'value' => $icon_color,
),
);
$classes = implode( ' ', $classes );
$classes_img = implode( ' ', $classes_img );
$link_atts = array(
'target' => $target,
'rel' => array( $rel ),
);
ob_start();
?>
<?php if ( $link ) echo '<a class="plain" href="' . $link . '"' . flatsome_parse_target_rel( $link_atts ) . '>'; ?>
<div class="icon-box <?php echo $classes; ?>" <?php if ( $tooltip )
echo 'title="' . $tooltip . '"' ?> <?php echo get_shortcode_inline_css( $css_args_out ); ?>>
<?php if ( $img ) { ?>
<div class="<?php echo $classes_img; ?>" style="<?php if ( $img_width ) {
echo $img_width;
} ?>">
<div class="icon">
<div class="icon-inner" <?php echo get_shortcode_inline_css( $css_args ); ?>>
<?php echo flatsome_get_image( $img, $size = 'medium', $alt = $title, $inline_svg ); ?>
</div>
</div>
</div>
<?php } ?>
<div class="icon-box-text last-reset">
<?php if ( $title ) { ?><h5 class="uppercase"><?php echo $title; ?></h5><?php } ?>
<?php if ( $title_small ) { ?><h6><?php echo $title_small; ?></h6><?php } ?>
<?php echo do_shortcode( $content ); ?>
</div>
</div>
<?php if ( $link ) echo '</a>'; ?>
<?php
$content = ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode( 'featured_box', 'featured_box' );

View File

@@ -0,0 +1,42 @@
<?php
// [gap]
function flatsome_gap_shortcode( $atts, $content = null ) {
extract( $atts = shortcode_atts( array(
'_id' => 'gap-' . rand(),
'height' => '30px',
'height__sm' => '',
'height__md' => '',
'class' => '',
'visibility' => '',
), $atts ) );
$classes = array( 'gap-element', 'clearfix' );
if ( $class ) {
$classes[] = $class;
}
if ( $visibility ) {
$classes[] = $visibility;
}
$classes = implode( ' ', $classes );
$args = array(
'height' => array(
'selector' => '',
'property' => 'padding-top',
),
);
ob_start();
?>
<div id="<?php echo esc_attr( $_id ); ?>" class="<?php echo esc_attr( $classes ); ?>" style="display:block; height:auto;">
<?php echo ux_builder_element_style_tag( $_id, $args, $atts ); // phpcs:disable WordPress.XSS.EscapeOutput.OutputNotEscaped ?>
</div>
<?php
return ob_get_clean();
}
add_shortcode( 'gap', 'flatsome_gap_shortcode' );

View File

@@ -0,0 +1,171 @@
<?php
// [map]
function flatsome_shortcode_map( $atts, $content = null, $tag = '' ) {
$atts = shortcode_atts(array(
'_id' => 'map-' . wp_rand(),
'class' => '',
'visibility' => '',
'lat' => '40.79028',
'long' => '-73.95972',
'height' => '400px',
'height__sm' => '',
'height__md' => '',
'color' => '',
'margin' => '',
'position_x' => '95',
'position_x__sm' => '',
'position_x__md' => '',
'position_y' => '95',
'position_y__sm' => '',
'position_y__md' => '',
'content_enable' => 'true',
'content_bg' => '#fff',
'content_width' => '30',
'content_width__sm' => '',
'content_width__md' => '',
'saturation' => '-30',
'zoom' => '17',
'controls' => 'false',
'zoom_control' => 'true',
'street_view_control' => 'true',
'map_type_control' => 'true',
'pan' => 'true',
), $atts);
extract( $atts );
$classes = array('google-map', 'relative', 'mb');
if( $class ) $classes[] = $class;
if( $visibility ) $classes[] = $visibility;
$classes = implode(' ', $classes);
$content_classes = array( 'map_inner', 'map-inner', 'last-reset absolute' );
$content_classes[] = flatsome_position_classes( 'x', $position_x, $position_x__sm, $position_x__md );
$content_classes[] = flatsome_position_classes( 'y', $position_y, $position_y__sm, $position_y__md );
wp_enqueue_script('flatsome-maps');
ob_start();
?>
<script type="text/javascript">
jQuery( document ).ready(function() {
function initialize() {
var styles = {
'flatsome': [{
"featureType": "administrative",
"stylers": [
{ "visibility": "on" }
]
},
{
"featureType": "road",
"stylers": [
{ "visibility": "on" },
{ "hue": "<?php echo $color ?>" }
]
},
{
"stylers": [
{ "visibility": "on" },
{ "hue": "<?php echo $color ?>" },
{ "saturation": <?php echo $saturation; ?> }
]
}
]};
var myLatlng = new google.maps.LatLng(<?php echo $lat ?>, <?php echo $long ?>);
var myOptions = {
zoom: <?php echo $zoom ?>,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
disableDefaultUI: true,
mapTypeId: 'flatsome',
draggable: <?php echo $pan; ?>,
zoomControl: <?php echo $controls == 'true' && $zoom_control == 'true' ? 'true' : 'false'; ?>,
zoomControlOptions: {
position: google.maps.ControlPosition.TOP_LEFT
},
// panControl: <?php echo $controls; ?>,
// panControlOptions: {
// position: google.maps.ControlPosition.TOP_LEFT
// },
mapTypeControl: <?php echo $controls == 'true' && $map_type_control == 'true' ? 'true' : 'false'; ?>,
mapTypeControlOptions: {
position: google.maps.ControlPosition.TOP_LEFT
},
// scaleControl: <?php echo $controls; ?>,
// scaleControlOptions: {
// position: google.maps.ControlPosition.TOP_LEFT
// },
streetViewControl: <?php echo $controls == 'true' && $street_view_control == 'true' ? 'true' : 'false'; ?>,
streetViewControlOptions: {
position: google.maps.ControlPosition.TOP_LEFT
},
// overviewMapControl: <?php echo $controls; ?>,
// overviewMapControlOptions: {
// position: google.maps.ControlPosition.TOP_LEFT
// },
scrollwheel: false,
disableDoubleClickZoom: true
}
var map = new google.maps.Map(document.getElementById("<?php echo $_id; ?>-inner"), myOptions);
var styledMapType = new google.maps.StyledMapType(styles['flatsome'], {name: 'flatsome'});
map.mapTypes.set('flatsome', styledMapType);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title:""
});
}
// Required to proceed
if (!(typeof google === 'object' && typeof google.maps === 'object')) {
return
}
initialize()
google.maps.event.addDomListener(window, 'resize', initialize);
});
</script>
<div class="<?php echo $classes; ?>" id="<?php echo $_id; ?>">
<div class="map-height" id="<?php echo $_id; ?>-inner"></div>
<div id="map_overlay_top"></div>
<div id="map_overlay_bottom"></div>
<?php if($content_enable) {?>
<div class="<?php echo implode( ' ', $content_classes ); ?>">
<?php echo do_shortcode( $content ); ?>
</div>
<?php }?>
<?php
// Get custom CSS
$args = array(
'content_bg' => array(
'selector' => '.map-inner',
'property' => 'background-color',
),
'content_width' => array(
'selector' => '.map-inner',
'property' => 'max-width',
'unit' => '%'
),
'height' => array(
'selector' => '.map-height',
'property' => 'height',
)
);
echo ux_builder_element_style_tag($_id, $args, $atts);
?>
</div>
<?php
$content = ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode('map', 'flatsome_shortcode_map');

View File

@@ -0,0 +1,78 @@
<?php
/**
* [lightbox]
*/
function ux_lightbox( $atts, $content = null ) {
extract( shortcode_atts( array(
'id' => 'enter-id-here',
'width' => '650px',
'padding' => '20px',
'class' => '',
'auto_open' => false,
'auto_timer' => '2500',
'auto_show' => '',
'version' => '1',
), $atts ) );
ob_start();
?>
<div id="<?php echo $id; ?>"
class="lightbox-by-id lightbox-content mfp-hide lightbox-white <?php echo $class; ?>"
style="max-width:<?php echo $width ?> ;padding:<?php echo $padding; ?>">
<?php echo do_shortcode( $content ); ?>
</div>
<?php if ( $auto_open ) : ?>
<script>
// Auto open lightboxes
jQuery(document).ready(function ($) {
/* global flatsomeVars */
'use strict'
var cookieId = '<?php echo "lightbox_{$id}" ?>'
var cookieValue = '<?php echo "opened_{$version}"; ?>'
var timer = parseInt('<?php echo $auto_timer; ?>')
// Auto open lightbox
<?php if ( $auto_show == 'always' ) : ?>
cookie(cookieId, false)
<?php endif; ?>
// Run lightbox if no cookie is set
if (cookie(cookieId) !== cookieValue) {
// Ensure closing off canvas
setTimeout(function () {
if (jQuery.fn.magnificPopup) jQuery.magnificPopup.close()
}, timer - 350)
// Open lightbox
setTimeout(function () {
$.loadMagnificPopup().then(function() {
$.magnificPopup.open({
midClick: true,
removalDelay: 300,
// closeBtnInside: flatsomeVars.lightbox.close_btn_inside,
// closeMarkup: flatsomeVars.lightbox.close_markup,
items: {
src: '#<?php echo $id; ?>',
type: 'inline'
}
})
})
}, timer)
// Set cookie
cookie(cookieId, cookieValue, 365)
}
})
</script>
<?php endif; ?>
<?php
$content = ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode( 'lightbox', 'ux_lightbox' );

View File

@@ -0,0 +1,45 @@
<?php
// [message_box]
function flatsome_message_box($atts, $content = null) {
extract(shortcode_atts(array(
'bg' => '',
'class' => '',
'visibility' => '',
'bg_color' => '',
'text_color' => 'dark',
'padding' => '15',
), $atts));
if($visibility == 'hidden') return;
$classes = array('message-box','relative');
if( $class ) $classes[] = $class;
if( $visibility ) $classes[] = $visibility;
if($bg) {
$bg = flatsome_get_image_url($bg);
}
if($text_color == 'dark') $classes[] = 'dark';
$css_args = array(
array( 'attribute' => 'padding-top', 'value' => $padding, 'unit' => 'px'),
array( 'attribute' => 'padding-bottom', 'value' => $padding, 'unit' => 'px'),
);
$css_bg = array();
if($bg) {
$css_bg = array(
array( 'attribute' => 'background-image', 'value' => 'url('.$bg.')'),
);
}
$css_bg_overlay = array(
array( 'attribute' => 'background-color', 'value' => $bg_color ),
);
return '<div class="'.implode(' ', $classes).'" '.get_shortcode_inline_css($css_args).'><div class="message-box-bg-image bg-fill fill" '.get_shortcode_inline_css($css_bg).'></div><div class="message-box-bg-overlay bg-fill fill" '.get_shortcode_inline_css($css_bg_overlay).'></div><div class="container relative"><div class="inner last-reset">'.do_shortcode($content).'</div></div></div>';
}
add_shortcode("message_box", "flatsome_message_box");

View File

@@ -0,0 +1,225 @@
<?php
// [page_header]
function flatsome_page_header_shortcode($atts) {
$atts = shortcode_atts( array(
'_id' => 'page-header-'.rand(),
'class' => '',
'visibility' => '',
// Layout
'height' => '',
'height__sm' => '',
'height__md' => '',
'margin' => '',
'margin__sm' => '',
'margin__md' => '',
'style' => 'featured', // divided / simple / normal / featured.
'align' => 'left',
'v_align' => 'center',
'type' => 'breadcrumbs', // none / breadcrumbs / subnav / onpage
'depth' => '',
'parallax' => '',
'parallax_text' => '',
'sticky' => '', // WIP
// Text
'text_color' => 'light',
// Background
'bg' => '',
'bg_color' => '',
'bg_overlay' => '',
'bg_overlay__sm' => '',
'bg_overlay__md' => '',
'bg_pos' => '',
'bg_size' => '',
// Titles
'show_title' => true,
'title' => '',
'title_size' => '',
'title_case' => '',
'sub_title' => '',
// Element
'nav_size' => '',
'nav_style' => 'line',
'nav_case' => 'uppercase',
// Show share
'share' => '',
), $atts);
extract( $atts );
$classes = array();
$container_classes = array( "align-{$v_align}" );
$subtitle_classes = array();
$content_classes = array();
if( $class ) $classes[] = $class;
if( $visibility ) $classes[] = $visibility;
if ($text_color == 'light') $classes[] = 'dark';
if ($text_color == 'dark') $classes[] = 'light';
if ( $style ) {
$classes[] = $style . '-title';
if ( $style == 'featured' ) {
// $classes[] = 'dark nav-dark';
if ( ! $bg ) $bg = get_post_thumbnail_id();
}
}
// Title
$title_classes = array();
if ( $title_case ) $title_classes[] = $title_case;
if ( $title_size ) $title_classes[] = 'is-' . $title_size;
if ( $parallax || $parallax_text ) $classes[] = 'has-parallax';
// Get default page title
if ( ! $title ) $title = get_the_title();
// Depth
if ( $depth ) $classes[] = 'box-shadow-'.$depth;
// Nav style
$nav_class = array('sm-touch-scroll');
if ( $nav_size ) $nav_class[] = 'nav-size-'.$nav_size;
if ( $nav_style ) $nav_class[] = 'nav-'.$nav_style;
if ( $nav_case ) $nav_class[] = 'nav-'.$nav_case;
if ( $align ) $nav_class[] = 'text-'.$align.' nav-'.$align;
$nav_class = implode(' ', $nav_class);
// Parallax text
if ( $parallax_text ) {
$parallax_text = 'data-parallax-fade="true" data-parallax="-' . $parallax_text . '"';
}
// Bg fix
$atts['bg'] = $bg;
// Add Content
ob_start();
// Breadcrumbs
if ( $type == 'breadcrumbs' ) {
echo '<div class="title-breadcrumbs pb-half pt-half">';
flatsome_breadcrumb( 'page-breadcrumbs' );
echo '</div>';
} else if ( $type == 'subnav' ) {
get_flatsome_subnav( $nav_class );
} else if ( $type == 'onpage' ) {
echo '<ul class="nav '.$nav_class.'"><li class="nav-single-page hidden"></li></ul>';
} else if ( $type == 'share' ) {
echo '<div class="title-share pt-half pb-half">' . do_shortcode( '[share]' ) . '</div>';
}
if ( $align == 'left' ) $content_align = 'right';
else if ( $align == 'right' ) $content_align = 'left';
else $content_align = 'center';
switch ( $align ) {
case 'center':
$container_classes[] = 'text-center flex-row-col medium-flex-wrap';
$title_classes[] = 'flex-col';
$subtitle_classes[] = 'flex-col';
$content_classes[] = 'flex-col';
break;
case 'right':
$container_classes[] = 'flex-row medium-flex-wrap row-reverse';
$title_classes[] = 'flex-col text-right medium-text-center';
$subtitle_classes[] = 'flex-col mr medium-text-center';
$content_classes[] = 'flex-col flex-left text-left medium-text-center';
break;
case 'left':
$container_classes[] = 'flex-row medium-flex-wrap';
$title_classes[] = 'flex-col text-left medium-text-center';
$subtitle_classes[] = 'flex-col ml medium-text-center';
$content_classes[] = 'flex-col flex-right text-right medium-text-center';
break;
}
// Sub nav
//get_flatsome_subnav($nav_class);
$content = ob_get_contents();
ob_end_clean();
ob_start();
?>
<div id="<?php echo $_id; ?>" class="page-header-wrapper">
<div class="page-title <?php echo implode(' ', $classes); ?>">
<?php if ( $bg || $bg_color ) { ?>
<div class="page-title-bg">
<div class="title-bg fill bg-fill"
data-parallax-container=".page-title"
data-parallax-background
data-parallax="-<?php echo $parallax; ?>">
</div>
<div class="title-overlay fill"></div>
</div>
<?php } ?>
<div class="page-title-inner container <?php echo implode( ' ', $container_classes ); ?>" <?php echo $parallax_text; ?>>
<?php if ( $show_title ) { ?>
<div class="title-wrapper <?php echo implode(' ', $title_classes ); ?>">
<h1 class="entry-title mb-0">
<?php echo $title; ?>
</h1>
</div>
<?php if ( $sub_title ) { ?>
<div class="page-title-sub op-7 <?php echo implode(' ', $subtitle_classes ); ?>">
<p class="lead"><?php echo $sub_title; ?></p>
</div>
<?php } ?>
<?php } ?>
<div class="title-content <?php echo implode( ' ', $content_classes ); ?>">
<?php echo $content; ?>
</div>
</div>
<?php
// Get custom CSS
$args = array(
'height' => array(
'selector' => '.page-title-inner',
'property' => 'min-height',
),
'margin' => array(
'selector' => '',
'property' => 'margin-bottom',
),
'bg' => array(
'selector' => '.title-bg',
'property' => 'background-image',
'size' => $bg_size
),
'bg_overlay' => array(
'selector' => '.title-overlay',
'property' => 'background-color',
),
'bg_color' => array(
'selector' => $style === 'featured' || $style === 'normal' ? '.' . $style . '-title' : '',
'property' => 'background-color',
),
'bg_pos' => array(
'selector' => '.title-bg',
'property' => 'background-position',
),
);
echo ux_builder_element_style_tag($_id, $args, $atts);
?>
</div>
<?php if($style == 'divided') echo '<div class="container header-wrapper-divider"><hr/></div>'; ?>
</div>
<?php
$content = ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode("page_header", "flatsome_page_header_shortcode");

View File

@@ -0,0 +1,303 @@
<?php
// [featured_items_slider]
function flatsome_portfolio_shortcode($atts, $content = null, $tag = '' ) {
extract(shortcode_atts(array(
// meta
'filter' => '',
'filter_nav' => 'line-grow',
'filter_align' => 'center',
'_id' => 'portfolio-'.rand(),
'link' => '',
'class' => '',
'visibility' => '',
'orderby' => 'menu_order',
'order' => '',
'offset' => '',
'exclude' => '',
'number' => '999',
'ids' => '',
'cat' => '',
'lightbox' => '',
'lightbox_image_size' => 'original',
// Layout
'style' => '',
'columns' => '4',
'columns__sm' => '',
'columns__md' => '',
'col_spacing' => 'small',
'type' => 'slider', // slider, row, masonery, grid
'width' => '',
'grid' => '1',
'grid_height' => '600px',
'grid_height__md' => '500px',
'grid_height__sm' => '400px',
'slider_nav_style' => 'reveal',
'slider_nav_position' => '',
'slider_nav_color' => '',
'slider_bullets' => 'false',
'slider_arrows' => 'true',
'auto_slide' => 'false',
'infinitive' => 'true',
'depth' => '',
'depth_hover' => '',
// Box styles
'animate' => '',
'text_pos' => '',
'text_padding' => '',
'text_bg' => '',
'text_color' => '',
'text_hover' => '',
'text_align' => 'center',
'text_size' => '',
'image_size' => 'medium',
'image_mask' => '',
'image_width' => '',
'image_radius' => '',
'image_height' => '100%',
'image_hover' => '',
'image_hover_alt' => '',
'image_overlay' => '',
// Deprecated
'height' => '',
), $atts));
ob_start();
if($height && !$image_height) $image_height = $height;
// Get Default Theme style
if(!$style) $style = flatsome_option('portfolio_style');
// Fix old
if($tag == 'featured_items_slider') $type = 'slider';
// Set Classes.
$wrapper_class = array( 'portfolio-element-wrapper', 'has-filtering' );
$classes_box = array( 'portfolio-box', 'box', 'has-hover' );
$classes_image = array();
$classes_text = array( 'box-text' );
// Fix Grid type
if($type == 'grid'){
$columns = 0;
$current_grid = 0;
$grid = flatsome_get_grid($grid);
$grid_total = count($grid);
flatsome_get_grid_height($grid_height, $_id);
}
// Wrapper classes.
if ( $visibility ) $wrapper_class[] = $visibility;
// Set box style
if($style) $classes_box[] = 'box-'.$style;
if($style == 'overlay') $classes_box[] = 'dark';
if($style == 'shade') $classes_box[] = 'dark';
if($style == 'badge') $classes_box[] = 'hover-dark';
if($text_pos) $classes_box[] = 'box-text-'.$text_pos;
if($style == 'overlay' && !$image_overlay) $image_overlay = true;
// Set image styles
if($image_hover) $classes_image[] = 'image-'.$image_hover;
if($image_hover_alt) $classes_image[] = 'image-'.$image_hover_alt;
if($image_height) $classes_image[] = 'image-cover';
// Text classes
if($text_hover) $classes_text[] = 'show-on-hover hover-'.$text_hover;
if($text_align) $classes_text[] = 'text-'.$text_align;
if($text_size) $classes_text[] = 'is-'.$text_size;
if($text_color == 'dark') $classes_text[] = 'dark';
$css_col = array(
array( 'attribute' => 'border-radius', 'value' => $image_radius, 'unit' => '%'),
);
$css_args_img = array(
array( 'attribute' => 'border-radius', 'value' => $image_radius, 'unit' => '%'),
array( 'attribute' => 'width', 'value' => $image_width, 'unit' => '%' ),
);
$css_image_height = array(
array( 'attribute' => 'padding-top', 'value' => $image_height),
);
$css_args = array(
array( 'attribute' => 'background-color', 'value' => $text_bg ),
array( 'attribute' => 'padding', 'value' => $text_padding ),
);
if($animate) {$animate = 'data-animate="'.$animate.'"';}
echo '<div id="' . $_id . '" class="' . implode( ' ', $wrapper_class ) . '">';
// Add filter
if($filter && $filter != 'disabled' && empty($cat) && $type !== 'grid' && $type !== 'slider' && $type !== 'full-slider'){
// TODO: Get categories for filtering.
wp_enqueue_script('flatsome-isotope-js');
?>
<div class="container mb-half">
<ul class="nav nav-<?php echo $filter;?> nav-<?php echo $filter_align ;?> nav-<?php echo $filter_nav;?> nav-uppercase filter-nav">
<li class="active"><a href="#" data-filter="*"><?php echo __('All','flatsome'); ?></a></li>
<?php
$tax_terms = get_terms('featured_item_category');
foreach ($tax_terms as $key => $value) {
?><li><a href="#" data-filter="[data-terms*='<?php echo "&quot;" . $value->name . "&quot;"; ?>']"><?php echo $value->name; ?></a></li><?php
}
?>
</ul>
</div>
<?php
} else{
$filter = false;
}
// Repeater options
$repeater['id'] = $_id;
$repeater['tag'] = $tag;
$repeater['type'] = $type;
$repeater['style'] = $style;
$repeater['class'] = $class;
$repeater['visibility'] = $visibility;
$repeater['slider_style'] = $slider_nav_style;
$repeater['slider_nav_color'] = $slider_nav_color;
$repeater['slider_nav_position'] = $slider_nav_position;
$repeater['slider_bullets'] = $slider_bullets;
$repeater['auto_slide'] = $auto_slide;
$repeater['infinitive'] = $infinitive;
$repeater['row_spacing'] = $col_spacing;
$repeater['row_width'] = $width;
$repeater['columns'] = $columns;
$repeater['columns__sm'] = $columns__sm;
$repeater['columns__md'] = $columns__md;
$repeater['depth'] = $depth;
$repeater['depth_hover'] = $depth_hover;
$repeater['filter'] = $filter;
global $wp_query;
$args = array(
'post_type' => 'featured_item',
);
// Exclude
// If custom Ids
if ( isset( $atts['ids'] ) ) {
$ids = explode( ',', $atts['ids'] );
$ids = array_map( 'trim', $ids );
$args['post__in'] = $ids;
$args['posts_per_page'] = -1;
$args['orderby'] = 'post__in';
} else {
$args['offset'] = $offset;
$args['order'] = $order;
$args['orderby'] = $orderby;
if($exclude) $args['post__not_in'] = explode( ',', $exclude );
$args['posts_per_page'] = $number;
if ( !empty( $atts['cat'] ) ) {
$args['tax_query'] = array(
array(
'taxonomy' => 'featured_item_category',
'field' => 'id',
'terms' => $cat,
),
);
}
}
$wp_query = new WP_Query( $args );
// Get repeater structure
get_flatsome_repeater_start($repeater);
?>
<?php
if ( $wp_query->have_posts() ) :
while ($wp_query->have_posts()) : $wp_query->the_post();
$link = get_permalink(get_the_ID());
$has_lightbox = '';
if($lightbox == 'true'){
$link = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), $lightbox_image_size );
$link = $link[0];
$has_lightbox = 'lightbox-gallery';
}
$image = get_post_thumbnail_id();
$classes_col = array('col');
// Add Columns for Grid style
if($type == 'grid'){
if($grid_total > $current_grid) $current_grid++;
$current = $current_grid-1;
$classes_col[] = 'grid-col';
if($grid[$current]['height']) $classes_col[] = 'grid-col-'.$grid[$current]['height'];
if($grid[$current]['span']) $classes_col[] = 'large-'.$grid[$current]['span'];
if($grid[$current]['md']) $classes_col[] = 'medium-'.$grid[$current]['md'];
// Set image size
if($grid[$current]['size']) $image_size = $grid[$current]['size'];
}
?><div class="<?php echo implode(' ', $classes_col); ?>" data-terms="<?php echo strip_tags( get_the_term_list( get_the_ID(), 'featured_item_category', "[&quot;", "&quot;,&quot;", "&quot;]" ) ); ?>" <?php echo $animate; ?>>
<div class="col-inner" <?php echo get_shortcode_inline_css($css_col); ?>>
<a href="<?php echo $link; ?>" class="plain <?php echo $has_lightbox; ?>">
<div class="<?php echo implode(' ', $classes_box); ?>">
<div class="box-image" <?php echo get_shortcode_inline_css( $css_args_img ); ?>>
<div class="<?php echo implode(' ', $classes_image); ?>" <?php echo get_shortcode_inline_css($css_image_height); ?>>
<?php echo wp_get_attachment_image($image, $image_size); ?>
<?php if($image_overlay) { ?><div class="overlay" style="background-color:<?php echo $image_overlay; ?>"></div><?php } ?>
<?php if($style == 'shade'){ ?><div class="shade"></div><?php } ?>
</div>
</div>
<div class="<?php echo implode(' ', $classes_text); ?>" <?php echo get_shortcode_inline_css( $css_args ); ?>>
<div class="box-text-inner">
<h6 class="uppercase portfolio-box-title"><?php the_title(); ?></h6>
<p class="uppercase portfolio-box-category is-xsmall op-6">
<span class="show-on-hover">
<?php echo strip_tags( get_the_term_list( get_the_ID(), 'featured_item_category', "",", " ) );?>
</span>
</p>
</div>
</div>
</div>
</a>
</div>
</div><?php
endwhile;
endif;
wp_reset_query();
get_flatsome_repeater_end($repeater);
echo '</div>';
$args = array(
'image_width' => array(
'selector' => '.box-image',
'property' => 'width',
'unit' => '%',
),
'text_padding' => array(
'selector' => '.box-text',
'property' => 'padding',
),
);
echo ux_builder_element_style_tag($_id, $args, $atts);
$content = ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode("featured_items_slider", "flatsome_portfolio_shortcode");
add_shortcode("featured_items_grid", "flatsome_portfolio_shortcode");
add_shortcode("ux_portfolio", "flatsome_portfolio_shortcode");

View File

@@ -0,0 +1,94 @@
<?php
// [ux_price_table]
function ux_price_table( $atts, $content = null ){
extract( shortcode_atts( array(
'class' => '',
'visibility' => '',
'title' => 'Title',
'price' => '$99.99',
'description' => '',
'featured' => '',
'radius' => '',
'color' => '',
'bg_color' => '',
'depth' => '',
'depth_hover' => '3',
// Depricated
'button_style' => '',
'button_text' => '',
'button_link' => '',
), $atts ) );
if($visibility == 'hidden') return;
ob_start();
$classes = array('pricing-table','ux_price_table');
$classes_wrapper = array('pricing-table-wrapper');
$classes[] = 'text-center';
if( $class ) $classes[] = $class;
if( $visibility ) $classes[] = $visibility;
if($color == 'dark') $classes_wrapper[] = 'dark';
if($depth) $classes[] = 'box-shadow-'.$depth;
if($depth_hover) $classes[] = 'box-shadow-'.$depth_hover.'-hover';
if($featured) $classes[] = 'featured-table';
$css_args = array(
array( 'attribute' => 'border-radius', 'value' => $radius, 'unit' => 'px'),
array( 'attribute' => 'background-color', 'value' => $bg_color ),
);
?>
<div class="<?php echo implode(' ', $classes_wrapper); ?>">
<div class="<?php echo implode(' ', $classes); ?>"<?php echo get_shortcode_inline_css($css_args); ?>>
<div class="pricing-table-header">
<div class="title uppercase strong"><?php echo $title;?></div>
<div class="price is-xxlarge"><?php echo $price;?></div>
<?php if(!empty($description)) { ?>
<div class="description is-small">
<?php echo $description;?>
</div>
<?php } ?>
</div>
<div class="pricing-table-items items">
<?php echo do_shortcode( $content ); ?>
</div>
<?php if($button_text) { ?>
<div class="cta-button">
<a class="button <?php echo $button_style;?>" href="<?php echo $button_link;?>">
<?php echo $button_text;?></a>
</div>
<?php } ?>
</div>
</div>
<?php
$content = ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode('ux_price_table', 'ux_price_table');
// Price bullet
function bullet_item( $atts, $content = null ){
extract( shortcode_atts( array(
'text' => 'Add any text here...',
'tooltip' => '',
'enabled' => ''
), $atts ) );
$tooltip_html = '';
$classes = array('bullet-item');
if($enabled == 'false') $classes[] = 'is-disabled';
if($tooltip) {
$classes[] = 'tooltip';
$classes[] = 'has-hover';
$tooltip_html = '<span class="tag-label bullet-more-info circle">?</span>';
}
$content = '<div class="'.implode(' ',$classes).'" title="'.$tooltip.'"><span class="text">'.$text.'</span>'.$tooltip_html.'</div>';
return $content;
}
add_shortcode('bullet_item', 'bullet_item');

View File

@@ -0,0 +1,258 @@
<?php
// [ux_product_categories]
function ux_product_categories($atts, $content = null, $tag = '' ) {
$sliderrandomid = rand();
extract( shortcode_atts( array (
// Meta
'number' => null,
'_id' => 'cats-'.rand(),
'ids' => false, // Custom IDs
'title' => '',
'cat' => '',
'orderby' => 'menu_order',
'order' => 'ASC',
'hide_empty' => 1,
'parent' => 'false',
'offset' => '',
'show_count' => 'true',
'class' => '',
'visibility' => '',
// Layout
'style' => 'badge',
'columns' => '4',
'columns__sm' => '',
'columns__md' => '',
'col_spacing' => 'small',
'type' => 'slider', // slider, row, masonery, grid
'width' => '',
'grid' => '1',
'grid_height' => '600px',
'grid_height__md' => '500px',
'grid_height__sm' => '400px',
'slider_nav_style' => 'reveal',
'slider_nav_color' => '',
'slider_nav_position' => '',
'slider_bullets' => 'false',
'slider_arrows' => 'true',
'auto_slide' => 'false',
'infinitive' => 'true',
'depth' => '',
'depth_hover' => '',
// Box styles
'animate' => '',
'text_pos' => '',
'text_padding' => '',
'text_bg' => '',
'text_color' => '',
'text_hover' => '',
'text_align' => 'center',
'text_size' => '',
'image_size' => '',
'image_mask' => '',
'image_width' => '',
'image_hover' => '',
'image_hover_alt' => '',
'image_radius' => '',
'image_height' => '',
'image_overlay' => '',
// depricated
'bg_overlay' => '#000',
), $atts ) );
if($tag == 'ux_product_categories_grid'){
$type = 'grid';
}
$hide_empty = ( $hide_empty == true || $hide_empty == 1 ) ? 1 : 0;
// if Ids
if ( isset( $atts[ 'ids' ] ) ) {
$ids = explode( ',', $atts[ 'ids' ] );
$ids = array_map( 'trim', $ids );
$parent = '';
$orderby = 'include';
} else {
$ids = array();
}
// get terms and workaround WP bug with parents/pad counts
$args = array(
'orderby' => $orderby,
'order' => $order,
'hide_empty' => $hide_empty,
'include' => $ids,
'pad_counts' => true,
'child_of' => 0,
'offset' => $offset,
);
ob_start();
$product_categories = get_terms( 'product_cat', $args );
if ( ! empty( $parent ) ) $product_categories = wp_list_filter( $product_categories, array( 'parent' => $parent === 'false' ? 0 : $parent ) );
if ( !empty($number) ) $product_categories = array_slice( $product_categories, 0, $number );
$classes_box = array('box','box-category','has-hover');
$classes_image = array();
$classes_text = array();
// Create Grid
if($type == 'grid'){
$columns = 0;
$current_grid = 0;
$grid = flatsome_get_grid($grid);
$grid_total = count($grid);
flatsome_get_grid_height($grid_height, $_id);
}
// Add Animations
if($animate) {$animate = 'data-animate="'.$animate.'"';}
// Set box style
if($style) $classes_box[] = 'box-'.$style;
if($style == 'overlay') $classes_box[] = 'dark';
if($style == 'shade') $classes_box[] = 'dark';
if($style == 'badge') $classes_box[] = 'hover-dark';
if($text_pos) $classes_box[] = 'box-text-'.$text_pos;
if($style == 'overlay' && !$image_overlay) $image_overlay = true;
// Set image styles
if($image_hover) $classes_image[] = 'image-'.$image_hover;
if($image_hover_alt) $classes_image[] = 'image-'.$image_hover_alt;
if($image_height) $classes_image[] = 'image-cover';
// Text classes
if($text_hover) $classes_text[] = 'show-on-hover hover-'.$text_hover;
if($text_align) $classes_text[] = 'text-'.$text_align;
if($text_size) $classes_text[] = 'is-'.$text_size;
if($text_color == 'dark') $classes_text[] = 'dark';
$css_args_img = array(
array( 'attribute' => 'border-radius', 'value' => $image_radius, 'unit' => '%'),
array( 'attribute' => 'width', 'value' => $image_width, 'unit' => '%' ),
);
$css_image_height = array(
array( 'attribute' => 'padding-top', 'value' => $image_height),
);
$css_args = array(
array( 'attribute' => 'background-color', 'value' => $text_bg ),
array( 'attribute' => 'padding', 'value' => $text_padding ),
);
// Repeater options
$repeater['id'] = $_id;
$repeater['class'] = $class;
$repeater['visibility'] = $visibility;
$repeater['tag'] = $tag;
$repeater['type'] = $type;
$repeater['style'] = $style;
$repeater['format'] = $image_height;
$repeater['slider_style'] = $slider_nav_style;
$repeater['slider_nav_color'] = $slider_nav_color;
$repeater['slider_nav_position'] = $slider_nav_position;
$repeater['slider_bullets'] = $slider_bullets;
$repeater['auto_slide'] = $auto_slide;
$repeater['infinitive'] = $infinitive;
$repeater['row_spacing'] = $col_spacing;
$repeater['row_width'] = $width;
$repeater['columns'] = $columns;
$repeater['columns__sm'] = $columns__sm;
$repeater['columns__md'] = $columns__md;
$repeater['depth'] = $depth;
$repeater['depth_hover'] = $depth_hover;
get_flatsome_repeater_start($repeater);
if ( $product_categories ) {
foreach ( $product_categories as $category ) {
$classes_col = array('product-category','col');
$thumbnail_size = apply_filters( 'single_product_archive_thumbnail_size', 'woocommerce_thumbnail' );
if($image_size) $thumbnail_size = $image_size;
if($type == 'grid'){
if($grid_total > $current_grid) $current_grid++;
$current = $current_grid-1;
$classes_col[] = 'grid-col';
if($grid[$current]['height']) $classes_col[] = 'grid-col-'.$grid[$current]['height'];
if($grid[$current]['span']) $classes_col[] = 'large-'.$grid[$current]['span'];
if($grid[$current]['md']) $classes_col[] = 'medium-'.$grid[$current]['md'];
// Set image size
if($grid[$current]['size'] == 'large') $thumbnail_size = 'large';
if($grid[$current]['size'] == 'medium') $thumbnail_size = 'medium';
}
$thumbnail_id = get_term_meta( $category->term_id, 'thumbnail_id', true );
if ( $thumbnail_id ) {
$image = wp_get_attachment_image_src( $thumbnail_id, $thumbnail_size);
$image = $image ? $image[0] : wc_placeholder_img_src();
} else {
$image = wc_placeholder_img_src();
}
?><div class="<?php echo implode(' ', $classes_col); ?>" <?php echo $animate;?>>
<div class="col-inner">
<?php do_action( 'woocommerce_before_subcategory', $category ); ?>
<div class="<?php echo implode(' ', $classes_box); ?> ">
<div class="box-image" <?php echo get_shortcode_inline_css($css_args_img); ?>>
<div class="<?php echo implode(' ', $classes_image); ?>" <?php echo get_shortcode_inline_css($css_image_height); ?>>
<?php echo '<img src="' . esc_url( $image ) . '" alt="' . esc_attr( $category->name ) . '" width="300" height="300" />'; ?>
<?php if($image_overlay){ ?><div class="overlay" style="background-color: <?php echo $image_overlay;?>"></div><?php } ?>
<?php if($style == 'shade'){ ?><div class="shade"></div><?php } ?>
</div>
</div>
<div class="box-text <?php echo implode(' ', $classes_text); ?>" <?php echo get_shortcode_inline_css($css_args); ?>>
<div class="box-text-inner">
<h5 class="uppercase header-title">
<?php echo $category->name; ?>
</h5>
<?php if($show_count) { ?>
<p class="is-xsmall uppercase count <?php if($style == 'overlay') echo 'show-on-hover hover-reveal reveal-small'; ?>">
<?php if ( $category->count > 0 ) {
echo apply_filters( 'woocommerce_subcategory_count_html', $category->count . ' ' . ( $category->count > 1 ? __( 'Products', 'woocommerce' ) : __( 'Product', 'woocommerce' ) ), $category );
}
?>
</p>
<?php } ?>
<?php
/**
* woocommerce_after_subcategory_title hook
*/
do_action( 'woocommerce_after_subcategory_title', $category );
?>
</div>
</div>
</div>
<?php do_action( 'woocommerce_after_subcategory', $category ); ?>
</div>
</div><?php
}
}
woocommerce_reset_loop();
get_flatsome_repeater_end($repeater);
$content = ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode("ux_product_categories", "ux_product_categories");
add_shortcode("ux_product_categories_grid", "ux_product_categories");

View File

@@ -0,0 +1,102 @@
<?php
// Flatsome Products
function ux_product_flip($atts, $content = null, $tag = '' ) {
$sliderrandomid = rand();
extract(shortcode_atts(array(
'_id' => 'product-flip-'.rand(),
'title' => '',
'ids' => '',
'width' => '',
'slider_nav_style' => 'normal',
'slider_nav_position' => 'outside',
'slider_bullets' => 'true',
'slider_arrows' => 'true',
'auto_slide' => 'false',
'infinitive' => 'true',
// posts
'cat' => '',
'excerpt' => 'visible',
'offset' => '',
'filter' => '',
// Posts Woo
'products' => '8',
'orderby' => '', // normal, sales, rand, date
'order' => '',
'tags' => '',
'show' => '', //featured, onsale
'depth' => '2',
'depth_hover' => '',
), $atts));
$slide_classes = array('slide');
$slider_classes = array('slide');
if($depth) $slider_classes[] = 'box-shadow-'.$depth;
ob_start();
?>
<?php
if(empty($ids)){
if ( ! is_array( $atts ) ) {
$atts = array();
}
// Get products
$atts['products'] = $products;
$atts['offset'] = $offset;
$atts['cat'] = $cat;
$products = ux_list_products($atts);
} else {
// Get custom ids
$ids = explode( ',', $ids );
$ids = array_map( 'trim', $ids );
$args = array(
'post__in' => $ids,
'post_type' => 'product',
'numberposts' => -1,
'posts_per_page' => -1,
'orderby' => 'post__in',
'ignore_sticky_posts' => true,
);
$products = new WP_Query( $args );
}
if ( $products->have_posts() ) : ?>
<div class="row"><div class="large-12 col">
<div style="background-color:#FFF;" class="slider flipContainer slider-nav-circle <?php echo implode(' ', $slider_classes);?>"
data-flickity-options='{
"cellAlign": "center",
"wrapAround": true,
"percentPosition": true,
"imagesLoaded": true,
"pageDots": true,
"contain": true
}'>
<?php while ( $products->have_posts() ) : $products->the_post(); ?>
<div class="<?php echo implode(' ', $slide_classes);?>" style="background-color:#FFF;"><?php wc_get_template_part( 'content', 'product-flipbook' ); ?></div>
<?php endwhile; // end of the loop. ?>
</div>
</div></div>
<?php
endif;
wp_reset_query();
$content = ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode("ux_product_flip", "ux_product_flip");

View File

@@ -0,0 +1,236 @@
<?php
// [row]
function ux_row($atts, $content = null) {
extract( shortcode_atts( array(
'_id' => 'row-'.rand(),
'style' => '',
'col_style' => '',
'label' => '',
'border_color' => '',
'width' => '',
'custom_width' => '',
'class' => '',
'visibility' => '',
'v_align' => '',
'h_align' => '',
'depth' => '',
'depth_hover' => '',
// Paddings
'padding' => '',
'col_bg' => '',
'col_bg_radius' => ''
), $atts ) );
// Stop if visibility is hidden
if($visibility == 'hidden') return;
$classes[] = 'row';
// Add Row style
if($style) $classes[] = 'row-'.$style;
// Add Row Width
if($width == 'full-width') $classes[] = 'row-full-width';
// Column Vertical Align
if($v_align) $classes[] = 'align-'.$v_align;
// Column Horizontal Align
if($h_align) $classes[] = 'align-'.$h_align;
// Column style
if($col_style) $classes[] = 'row-'.$col_style;
// Custom Class
if($class) $classes[] = $class;
if($visibility) $classes[] = $visibility;
// Depth
if($depth) $classes[] = 'row-box-shadow-'.$depth;
if($depth_hover) $classes[] = 'row-box-shadow-'.$depth_hover.'-hover';
// Add Custom Widths
if($width !== 'custom'){
$custom_width = '';
} else{
$custom_width = 'style="max-width:'.$custom_width.'"';
}
$args = array(
'padding' => array(
'selector' => '> .col > .col-inner',
'property' => 'padding',
),
'col_bg' => array(
'selector' => '> .col > .col-inner',
'property' => 'background-color',
),
'col_bg_radius' => array(
'selector' => '> .col > .col-inner',
'property' => 'border-radius',
'unit' => 'px',
),
);
$classes = implode(" ", $classes);
return '<div class="'.$classes.'" '.$custom_width.' id="'.$_id.'">'.do_shortcode( $content ).ux_builder_element_style_tag($_id, $args, $atts).'</div>';
}
// [col]
function ux_col($atts, $content = null) {
extract( $atts = shortcode_atts( array(
'_id' => 'col-'.rand(),
'label' => '',
'span' => '12',
'span__md' => isset( $atts['span'] ) ? $atts['span'] : '',
'span__sm' => '',
'small' => '12',
'visibility' => '',
'divider' => '',
'animate' => '',
'padding' => '',
'padding__md' => '',
'padding__sm' => '',
'margin' => '',
'margin__md' => '',
'margin__sm' => '',
'tooltip' => '',
'max_width' => '',
'hover' => '',
'class' => '',
'align' => '',
'color' => '',
'sticky' => '',
'parallax' => '',
'force_first' => '',
'bg' => '',
'bg_color' => '',
'bg_radius' => '',
'depth' => '',
'depth_hover' => '',
'text_depth' => '',
// Border Control.
'border' => '',
'border_margin' => '',
'border_style' => '',
'border_radius' => '',
'border_color' => '',
'border_hover' => '',
), $atts ) );
// Hide if visibility is hidden
if($visibility == 'hidden') return;
$classes[] = 'col';
$classes_inner[] = 'col-inner';
// Fix old cols
if(strpos($span, '/')) $span = flatsome_fix_span($span);
// add custom class
if($class) $classes[] = $class;
if($visibility) $classes[] = $visibility;
if($span__md) $classes[] = 'medium-'.$span__md;
if($span__sm) $classes[] = 'small-'.$span__sm;
if($span) $classes[] = 'large-'.$span;
if ( $border_hover ) $classes[] = 'has-hover';
// Force first position
if($force_first) $classes[] = $force_first.'-col-first';
// Add divider
if($divider) $classes[] = 'col-divided';
// Add Animation Class
if($animate) { $animate = 'data-animate="'.$animate.'"'; }
// Add Align Class
if($align) $classes_inner[] = 'text-'.$align;
// Add Hover Class
if($hover) $classes[] = 'col-hover-'.$hover;
// Add Depth Class
if($depth) $classes_inner[] = 'box-shadow-'.$depth;
if($depth_hover) $classes_inner[] = 'box-shadow-'.$depth_hover.'-hover';
if($text_depth) $classes_inner[] = 'text-shadow-'.$text_depth;
// Add Color class
if($color == 'light') $classes_inner[] = 'dark';
// Add Toolip Html
$tooltip_class = '';
if($tooltip) {
$tooltip = 'title="'.$tooltip.'"';
$classes[] = 'tip-top';
}
// Parallax
if($parallax) $parallax = 'data-parallax-fade="true" data-parallax="'.$parallax.'"';
// Inline CSS
$css_args = array(
'span' => array(
'attribute' => 'max-width',
'value' => $max_width,
),
'bg_color' => array(
'attribute' => 'background-color',
'value' => $bg_color,
),
);
$args = array(
'padding' => array(
'selector' => '> .col-inner',
'property' => 'padding',
),
'margin' => array(
'selector' => '> .col-inner',
'property' => 'margin',
),
'bg_radius' => array(
'selector' => '> .col-inner',
'property' => 'border-radius',
'unit' => 'px',
),
);
$classes = implode( ' ', $classes );
$classes_inner = implode( ' ', $classes_inner );
$attributes = implode( ' ', array( $tooltip, $animate ) );
$attributes_inner = $parallax;
ob_start();
?>
<div id="<?php echo $_id; ?>" class="<?php echo esc_attr( $classes ); ?>" <?php echo $attributes; ?>>
<?php if ( $sticky ) flatsome_sticky_column_open(); ?>
<div class="<?php echo esc_attr( $classes_inner ); ?>" <?php echo get_shortcode_inline_css( $css_args ); ?> <?php echo $attributes_inner; ?>>
<?php require __DIR__ . '/commons/border.php'; ?>
<?php echo do_shortcode( $content ); ?>
</div>
<?php if ( $sticky ) flatsome_sticky_column_close(); ?>
<?php echo ux_builder_element_style_tag( $_id, $args, $atts ); ?>
</div>
<?php
return ob_get_clean();
}
add_shortcode('col', 'ux_col');
add_shortcode('col_inner', 'ux_col');
add_shortcode('col_inner_1', 'ux_col');
add_shortcode('col_inner_2', 'ux_col');
add_shortcode('row', 'ux_row');
add_shortcode('row_inner', 'ux_row');
add_shortcode('row_inner_1', 'ux_row');
add_shortcode('row_inner_2', 'ux_row');
add_shortcode('background', 'ux_section');
add_shortcode('section', 'ux_section');
add_shortcode( 'section_inner', 'ux_section' );

View File

@@ -0,0 +1,25 @@
<?php
function flatsome_scroll_to( $atts, $content = null ) {
extract( shortcode_atts( array(
'bullet' => 'true',
'title' => 'Change this',
'link' => '',
), $atts ) );
if ( ! $title && ! $link ) {
return false;
}
// Convert title to link if link is not set.
if ( ! $link ) {
$link = flatsome_to_dashed( $title );
}
if ( substr( $link, 0, 1 ) !== '#' ) {
$link = '#' . $link;
}
return '<span class="scroll-to" data-label="Scroll to: ' . $link . '" data-bullet="' . $bullet . '" data-link="' . $link . '" data-title="' . $title . '"><a name="' . str_replace( '#', '', $link ) . '"></a></span>';
}
add_shortcode( 'scroll_to', 'flatsome_scroll_to' );

View File

@@ -0,0 +1,34 @@
<?php
// [search]
function search_shortcode($atts) {
extract(shortcode_atts(array(
'size' => 'normal',
'style' => '',
'class' => '',
'visibility' => ''
), $atts));
$classes = array( 'searchform-wrapper' , 'ux-search-box', 'relative' );
if( $class ) $classes[] = $class;
if( $visibility ) $classes[] = $visibility;
if( $style ) $classes[] = 'form-'.$style;
if( $size ) $classes[] = 'is-'.$size;
$classes = implode(' ', $classes);
ob_start();
echo '<div class="'. $classes. '">';
if(function_exists('get_product_search_form')) {
get_product_search_form();
} else {
get_search_form();
}
echo '</div>';
$content = ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode("search", "search_shortcode");

View File

@@ -0,0 +1,238 @@
<?php
function ux_section( $atts, $content = null ) {
$atts = shortcode_atts( array(
'_id' => 'section_' . rand(),
'class' => '',
'label' => '',
'visibility' => '',
'sticky' => '',
// Background.
'bg' => '',
'bg_size' => '',
'bg_color' => '',
'bg_overlay' => '',
'bg_overlay__sm' => '',
'bg_overlay__md' => '',
'bg_pos' => '',
'parallax' => '',
'effect' => '',
// Video.
'video_mp4' => '',
'video_ogg' => '',
'video_webm' => '',
'video_sound' => 'false',
'video_loop' => 'true',
'youtube' => '',
'video_visibility' => 'hide-for-medium',
// Layout.
'dark' => 'false',
'mask' => '',
'padding' => '30px',
'padding__sm' => '',
'padding__md' => '',
'height' => '',
'height__sm' => '',
'height__md' => '',
'margin' => '',
'loading' => '',
'scroll_for_more' => '',
// Shape divider.
'divider_top' => '',
'divider_top_height' => '150px',
'divider_top_height__sm' => null,
'divider_top_height__md' => null,
'divider_top_width' => '100',
'divider_top_width__sm' => null,
'divider_top_width__md' => null,
'divider_top_fill' => '',
'divider_top_flip' => 'false',
'divider_top_to_front' => 'false',
'divider' => '',
'divider_height' => '150px',
'divider_height__sm' => null,
'divider_height__md' => null,
'divider_width' => '100',
'divider_width__sm' => null,
'divider_width__md' => null,
'divider_fill' => '',
'divider_flip' => 'false',
'divider_to_front' => 'false',
// Border Control.
'border' => '',
'border_hover' => '',
'border_color' => '',
'border_margin' => '',
'border_radius' => '',
'border_style' => '',
), $atts );
extract( $atts );
// Hide if visibility is hidden.
if ( $visibility === 'hidden' ) {
return;
}
ob_start();
$classes = array( 'section' );
$classes_bg = array( 'bg', 'section-bg', 'fill', 'bg-fill' );
// Fix old.
if ( strpos( $bg, '#' ) !== false ) {
$atts['bg_color'] = $bg;
$atts['bg'] = false;
}
// Add Custom Classes.
if ( $class ) {
$classes[] = $class;
}
// Add Dark text.
if ( $dark === 'true' ) {
$classes[] = 'dark';
}
// If sticky section.
if ( $sticky ) {
$classes[] = 'sticky-section';
}
// Add Mask.
if ( $mask ) {
$classes[] = 'has-mask mask-' . $mask;
}
// Add visibility class.
if ( $visibility ) {
$classes[] = $visibility;
}
// Add Parallax.
if ( $parallax ) {
$classes[] = 'has-parallax';
$parallax = 'data-parallax-container=".section" data-parallax-background data-parallax="-' . $parallax . '"';
}
// Background effects.
if ( $effect ) {
wp_enqueue_style( 'flatsome-effects' );
}
// Add Full Height Class.
if ( $height === '100vh' ) {
$classes[] = 'is-full-height';
}
// Lazy load.
$classes_bg[] = get_theme_mod( 'lazy_load_backgrounds', 1 ) ? '' : 'bg-loaded';
$classes_bg[] = $bg ? '' : 'bg-loaded';
if ( $border_hover ) {
$classes[] = 'has-hover';
}
$classes = implode( ' ', $classes );
$classes_bg = implode( ' ', $classes_bg );
?>
<section class="<?php echo $classes; ?>" id="<?php echo $_id; ?>">
<div class="<?php echo $classes_bg; ?>" <?php echo $parallax; ?>>
<?php require( __DIR__ . '/commons/video.php' ); ?>
<?php
if ( $bg_overlay ) {
echo '<div class="section-bg-overlay absolute fill"></div>';
}
if ( $loading ) {
echo '<div class="loading-spin centered"></div>';
}
if ( $scroll_for_more ) {
echo '<button class="scroll-for-more z-5 icon absolute bottom h-center" aria-label="' . esc_attr__( 'Scroll for more', 'flatsome' ) . '">' . get_flatsome_icon( 'icon-angle-down', '42px' ) . '</button>';
}
if ( $effect ) {
echo '<div class="effect-' . $effect . ' bg-effect fill no-click"></div>';
}
?>
<?php require( __DIR__ . '/commons/border.php' ); ?>
</div>
<?php require __DIR__ . '/commons/shape-divider.php'; ?>
<div class="section-content relative">
<?php echo $content; ?>
</div>
<?php
// Get custom CSS.
$args = array(
'padding' => array(
'selector' => '',
'property' => 'padding-top, padding-bottom',
),
'margin' => array(
'selector' => '',
'property' => 'margin-bottom',
),
'height' => array(
'selector' => '',
'property' => 'min-height',
),
'bg_color' => array(
'selector' => '',
'property' => 'background-color',
),
'bg_overlay' => array(
'selector' => '.section-bg-overlay',
'property' => 'background-color',
),
'bg' => array(
'selector' => '.section-bg.bg-loaded',
'property' => 'background-image',
'size' => $bg_size,
),
'bg_pos' => array(
'selector' => '.section-bg',
'property' => 'background-position',
),
'divider_top_height' => array(
'selector' => '.ux-shape-divider--top svg',
'property' => 'height',
),
'divider_top_width' => array(
'selector' => '.ux-shape-divider--top svg',
'property' => '--divider-top-width',
'unit' => '%',
),
'divider_top_fill' => array(
'selector' => '.ux-shape-divider--top .ux-shape-fill',
'property' => 'fill',
),
'divider_height' => array(
'selector' => '.ux-shape-divider--bottom svg',
'property' => 'height',
),
'divider_width' => array(
'selector' => '.ux-shape-divider--bottom svg',
'property' => '--divider-width',
'unit' => '%',
),
'divider_fill' => array(
'selector' => '.ux-shape-divider--bottom .ux-shape-fill',
'property' => 'fill',
),
);
echo ux_builder_element_style_tag( $_id, $args, $atts );
?>
</section>
<?php
$content = ob_get_contents();
ob_end_clean();
return do_shortcode( $content );
}

View File

@@ -0,0 +1,268 @@
<?php
// [share]
function flatsome_share($atts, $content = null) {
extract(shortcode_atts(array(
'title' => '',
'class' => '',
'visibility' => '',
'size' => '',
'align' => '',
'scale' => '',
'style' => '',
), $atts));
// Get Custom Share icons if set
if(get_theme_mod('custom_share_icons')){
return do_shortcode(get_theme_mod('custom_share_icons'));
}
$wrapper_class = array('social-icons','share-icons', 'share-row', 'relative');
if( $class ) $wrapper_class[] = $class;
if( $visibility ) $wrapper_class[] = $visibility;
if( $align ) {
$wrapper_class[] = 'full-width';
$wrapper_class[] = 'text-'.$align;
}
if ( $style ) $wrapper_class[] = 'icon-style-'.$style;
$link = get_permalink();
if ( is_woocommerce_activated() ) {
if ( is_shop() ) {
$link = get_permalink( wc_get_page_id( 'shop' ) );
}
if ( is_product_category() || is_category() ) {
$link = get_category_link( get_queried_object()->term_id );
}
}
if ( is_home() && ! is_front_page() ) {
$link = get_permalink( get_option( 'page_for_posts' ) );
}
$featured_image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large' );
$share_img = $featured_image ? $featured_image['0'] : '';
$post_title = rawurlencode( get_the_title() );
$whatsapp_text = $post_title . ' - ' . $link;
if($title) $title = '<span class="share-icons-title">'.$title.'</span>';
// Style default
// Get Custom Theme Style
if(!$style) $style = get_theme_mod('social_icons_style','outline');
$classes = get_flatsome_icon_class($style);
$classes = $classes. ' tooltip';
$share = get_theme_mod('social_icons', array('facebook','twitter','email','linkedin','pinterest','whatsapp'));
// Scale
if($scale) $scale = 'style="font-size:'.$scale.'%"';
// Fix old depricated
if(!isset($share[0])){
$fix_share = array();
foreach ($share as $key => $value) {
if($value == '1') $fix_share[] = $key;
}
$share = $fix_share;
}
ob_start();
?>
<div class="<?php echo implode(' ', $wrapper_class); ?>" <?php echo $scale;?>>
<?php echo $title; ?>
<?php if(in_array('whatsapp', $share)){ ?>
<a href="whatsapp://send?text=<?php echo $whatsapp_text; ?>" data-action="share/whatsapp/share" class="<?php echo $classes;?> whatsapp show-for-medium" title="<?php _e('Share on WhatsApp','flatsome'); ?>" aria-label="<?php esc_attr_e( 'Share on WhatsApp', 'flatsome' ); ?>"><i class="icon-whatsapp"></i></a>
<?php } if(in_array('facebook', $share)){ ?>
<a href="https://www.facebook.com/sharer.php?u=<?php echo $link; ?>" data-label="Facebook" onclick="window.open(this.href,this.title,'width=500,height=500,top=300px,left=300px'); return false;" rel="noopener noreferrer nofollow" target="_blank" class="<?php echo $classes;?> facebook" title="<?php _e('Share on Facebook','flatsome'); ?>" aria-label="<?php esc_attr_e( 'Share on Facebook', 'flatsome' ); ?>"><?php echo get_flatsome_icon('icon-facebook'); ?></a>
<?php } if(in_array('twitter', $share)){ ?>
<a href="https://twitter.com/share?url=<?php echo $link; ?>" onclick="window.open(this.href,this.title,'width=500,height=500,top=300px,left=300px'); return false;" rel="noopener noreferrer nofollow" target="_blank" class="<?php echo $classes;?> twitter" title="<?php _e('Share on Twitter','flatsome'); ?>" aria-label="<?php esc_attr_e( 'Share on Twitter','flatsome' ); ?>"><?php echo get_flatsome_icon('icon-twitter'); ?></a>
<?php } if(in_array('email', $share)){ ?>
<a href="mailto:enteryour@addresshere.com?subject=<?php echo $post_title; ?>&amp;body=Check%20this%20out:%20<?php echo $link; ?>" rel="nofollow" class="<?php echo $classes;?> email" title="<?php _e('Email to a Friend','flatsome'); ?>" aria-label="<?php esc_attr_e( 'Email to a Friend','flatsome' ); ?>"><?php echo get_flatsome_icon('icon-envelop'); ?></a>
<?php } if(in_array('pinterest', $share)){ ?>
<a href="https://pinterest.com/pin/create/button/?url=<?php echo $link; ?>&amp;media=<?php echo $share_img; ?>&amp;description=<?php echo $post_title; ?>" onclick="window.open(this.href,this.title,'width=500,height=500,top=300px,left=300px'); return false;" rel="noopener noreferrer nofollow" target="_blank" class="<?php echo $classes;?> pinterest" title="<?php _e('Pin on Pinterest','flatsome'); ?>" aria-label="<?php esc_attr_e( 'Pin on Pinterest', 'flatsome' ); ?>"><?php echo get_flatsome_icon('icon-pinterest'); ?></a>
<?php } if(in_array('vk', $share)){ ?>
<a href="https://vkontakte.ru/share.php?url=<?php echo $link; ?>" target="_blank" class="<?php echo $classes;?> vk" onclick="window.open(this.href,this.title,'width=500,height=500,top=300px,left=300px'); return false;" rel="noopener noreferrer nofollow" title="<?php _e('Share on VKontakte','flatsome'); ?>" aria-label="<?php esc_attr_e( 'Share on VKontakte', 'flatsome' ); ?>"><?php echo get_flatsome_icon('icon-vk'); ?></a>
<?php } if(in_array('linkedin', $share)){ ?>
<a href="https://www.linkedin.com/shareArticle?mini=true&url=<?php echo $link; ?>&title=<?php echo $post_title; ?>" onclick="window.open(this.href,this.title,'width=500,height=500,top=300px,left=300px'); return false;" rel="noopener noreferrer nofollow" target="_blank" class="<?php echo $classes;?> linkedin" title="<?php _e('Share on LinkedIn','flatsome'); ?>" aria-label="<?php esc_attr_e( 'Share on LinkedIn', 'flatsome' ); ?>"><?php echo get_flatsome_icon('icon-linkedin'); ?></a>
<?php } if(in_array('tumblr', $share)){ ?>
<a href="https://tumblr.com/widgets/share/tool?canonicalUrl=<?php echo $link; ?>" target="_blank" class="<?php echo $classes;?> tumblr" onclick="window.open(this.href,this.title,'width=500,height=500,top=300px,left=300px'); return false;" rel="noopener noreferrer nofollow" title="<?php _e('Share on Tumblr','flatsome'); ?>" aria-label="<?php esc_attr_e( 'Share on Tumblr', 'flatsome' ); ?>"><?php echo get_flatsome_icon('icon-tumblr'); ?></a>
<?php } if(in_array('telegram', $share)){ ?>
<a href="https://telegram.me/share/url?url=<?php echo $link; ?>" onclick="window.open(this.href,this.title,'width=500,height=500,top=300px,left=300px'); return false;" rel="noopener noreferrer nofollow" target="_blank" class="<?php echo $classes;?> telegram" title="<?php _e('Share on Telegram','flatsome'); ?>" aria-label="<?php esc_attr_e( 'Share on Telegram', 'flatsome' ); ?>"><?php echo get_flatsome_icon('icon-telegram'); ?></a>
<?php } ?>
</div>
<?php
$content = ob_get_contents();
ob_end_clean();
$content = flatsome_sanitize_whitespace_chars( $content);
return $content;
}
add_shortcode('share','flatsome_share');
// [follow]
function flatsome_follow($atts, $content = null) {
extract(shortcode_atts(array(
'title' => '',
'class' => '',
'visibility' => '',
'style' => 'outline',
'align' => '',
'scale' => '',
'twitter' => '',
'facebook' => '',
'pinterest' => '',
'email' => '',
'phone' => '',
'instagram' => '',
'tiktok' => '',
'rss' => '',
'linkedin' => '',
'youtube' => '',
'flickr' => '',
'vkontakte' => '',
'px500' => '',
'telegram' => '',
'twitch' => '',
'discord' => '',
'snapchat' => '',
// Depricated
'size' => '',
), $atts));
ob_start();
$wrapper_class = array('social-icons','follow-icons');
if( $class ) $wrapper_class[] = $class;
if( $visibility ) $wrapper_class[] = $visibility;
if( $align ) {
$wrapper_class[] = 'full-width';
$wrapper_class[] = 'text-'.$align;
}
// Use global follow links if non is set individually.
$has_custom_link = $twitter || $facebook || $instagram || $tiktok || $snapchat || $youtube || $pinterest || $linkedin || $px500 || $vkontakte || $telegram || $flickr || $email || $phone || $rss || $twitch || $discord;
if ( ! $has_custom_link ) {
$twitter = get_theme_mod( 'follow_twitter' );
$facebook = get_theme_mod( 'follow_facebook' );
$instagram = get_theme_mod( 'follow_instagram' );
$tiktok = get_theme_mod( 'follow_tiktok' );
$snapchat = get_theme_mod( 'follow_snapchat' );
$youtube = get_theme_mod( 'follow_youtube' );
$pinterest = get_theme_mod( 'follow_pinterest' );
$linkedin = get_theme_mod( 'follow_linkedin' );
$px500 = get_theme_mod( 'follow_500px' );
$vkontakte = get_theme_mod( 'follow_vk' );
$telegram = get_theme_mod( 'follow_telegram' );
$flickr = get_theme_mod( 'follow_flickr' );
$email = get_theme_mod( 'follow_email' );
$phone = get_theme_mod( 'follow_phone' );
$rss = get_theme_mod( 'follow_rss' );
$twitch = get_theme_mod( 'follow_twitch' );
$discord = get_theme_mod( 'follow_discord' );
}
if($size == 'small') $style = 'small';
$style = get_flatsome_icon_class($style);
// Scale
if($scale) $scale = 'style="font-size:'.$scale.'%"';
?>
<div class="<?php echo implode(' ', $wrapper_class); ?>" <?php echo $scale;?>>
<?php if($title){?>
<span><?php echo $title; ?></span>
<?php }?>
<?php if($facebook){?>
<a href="<?php echo $facebook; ?>" target="_blank" data-label="Facebook" rel="noopener noreferrer nofollow" class="<?php echo $style; ?> facebook tooltip" title="<?php _e('Follow on Facebook','flatsome') ?>" aria-label="<?php esc_attr_e( 'Follow on Facebook', 'flatsome' ); ?>"><?php echo get_flatsome_icon('icon-facebook'); ?>
</a>
<?php }?>
<?php if($instagram){?>
<a href="<?php echo $instagram; ?>" target="_blank" rel="noopener noreferrer nofollow" data-label="Instagram" class="<?php echo $style; ?> instagram tooltip" title="<?php _e('Follow on Instagram','flatsome')?>" aria-label="<?php esc_attr_e( 'Follow on Instagram', 'flatsome' ); ?>"><?php echo get_flatsome_icon('icon-instagram'); ?>
</a>
<?php }?>
<?php if ( $tiktok ) { ?>
<a href="<?php echo $tiktok; ?>" target="_blank" rel="noopener noreferrer nofollow" data-label="TikTok" class="<?php echo $style; ?> tiktok tooltip" title="<?php _e( 'Follow on TikTok', 'flatsome' ) ?>" aria-label="<?php esc_attr_e( 'Follow on TikTok', 'flatsome' ); ?>"><?php echo get_flatsome_icon( 'icon-tiktok' ); ?>
</a>
<?php } ?>
<?php if($snapchat){?>
<a href="#" data-open="#follow-snapchat-lightbox" data-color="dark" data-pos="center" target="_blank" rel="noopener noreferrer nofollow" data-label="SnapChat" class="<?php echo $style; ?> snapchat tooltip" title="<?php _e('Follow on SnapChat','flatsome')?>" aria-label="<?php esc_attr_e( 'Follow on SnapChat', 'flatsome' ); ?>"><?php echo get_flatsome_icon('icon-snapchat'); ?>
</a>
<div id="follow-snapchat-lightbox" class="mfp-hide">
<div class="text-center">
<?php echo do_shortcode(flatsome_get_image($snapchat)) ;?>
<p><?php _e('Point the SnapChat camera at this to add us to SnapChat.','flatsome'); ?></p>
</div>
</div>
<?php }?>
<?php if($twitter){?>
<a href="<?php echo $twitter; ?>" target="_blank" data-label="Twitter" rel="noopener noreferrer nofollow" class="<?php echo $style; ?> twitter tooltip" title="<?php _e('Follow on Twitter','flatsome') ?>" aria-label="<?php esc_attr_e( 'Follow on Twitter', 'flatsome' ); ?>"><?php echo get_flatsome_icon('icon-twitter'); ?>
</a>
<?php }?>
<?php if($email){?>
<a href="mailto:<?php echo $email; ?>" data-label="E-mail" rel="nofollow" class="<?php echo $style; ?> email tooltip" title="<?php _e('Send us an email','flatsome') ?>" aria-label="<?php esc_attr_e( 'Send us an email', 'flatsome' ); ?>"><?php echo get_flatsome_icon('icon-envelop'); ?>
</a>
<?php }?>
<?php if($phone){?>
<a href="tel:<?php echo $phone; ?>" target="_blank" data-label="Phone" rel="noopener noreferrer nofollow" class="<?php echo $style; ?> phone tooltip" title="<?php _e('Call us','flatsome') ?>" aria-label="<?php esc_attr_e( 'Call us', 'flatsome' ); ?>"><?php echo get_flatsome_icon('icon-phone'); ?>
</a>
<?php }?>
<?php if($pinterest){?>
<a href="<?php echo $pinterest; ?>" target="_blank" rel="noopener noreferrer nofollow" data-label="Pinterest" class="<?php echo $style; ?> pinterest tooltip" title="<?php _e('Follow on Pinterest','flatsome') ?>" aria-label="<?php esc_attr_e( 'Follow on Pinterest', 'flatsome' ); ?>"><?php echo get_flatsome_icon('icon-pinterest'); ?>
</a>
<?php }?>
<?php if($rss){?>
<a href="<?php echo $rss; ?>" target="_blank" rel="noopener noreferrer nofollow" data-label="RSS Feed" class="<?php echo $style; ?> rss tooltip" title="<?php _e('Subscribe to RSS','flatsome') ?>" aria-label="<?php esc_attr_e( 'Subscribe to RSS', 'flatsome' ); ?>"><?php echo get_flatsome_icon('icon-feed'); ?></a>
<?php }?>
<?php if($linkedin){?>
<a href="<?php echo $linkedin; ?>" target="_blank" rel="noopener noreferrer nofollow" data-label="LinkedIn" class="<?php echo $style; ?> linkedin tooltip" title="<?php _e('Follow on LinkedIn','flatsome') ?>" aria-label="<?php esc_attr_e( 'Follow on LinkedIn', 'flatsome' ); ?>"><?php echo get_flatsome_icon('icon-linkedin'); ?></a>
<?php }?>
<?php if($youtube){?>
<a href="<?php echo $youtube; ?>" target="_blank" rel="noopener noreferrer nofollow" data-label="YouTube" class="<?php echo $style; ?> youtube tooltip" title="<?php _e('Follow on YouTube','flatsome') ?>" aria-label="<?php esc_attr_e( 'Follow on YouTube', 'flatsome' ); ?>"><?php echo get_flatsome_icon('icon-youtube'); ?>
</a>
<?php }?>
<?php if($flickr){?>
<a href="<?php echo $flickr; ?>" target="_blank" rel="noopener noreferrer nofollow" data-label="Flickr" class="<?php echo $style; ?> flickr tooltip" title="<?php _e('Flickr','flatsome') ?>" aria-label="<?php esc_attr_e( 'Flickr', 'flatsome' ); ?>"><?php echo get_flatsome_icon('icon-flickr'); ?>
</a>
<?php }?>
<?php if($px500){?>
<a href="<?php echo $px500; ?>" target="_blank" data-label="500px" rel="noopener noreferrer nofollow" class="<?php echo $style; ?> px500 tooltip" title="<?php _e('Follow on 500px','flatsome') ?>" aria-label="<?php esc_attr_e( 'Follow on 500px', 'flatsome' ); ?>"><?php echo get_flatsome_icon('icon-500px'); ?>
</a>
<?php }?>
<?php if($vkontakte){?>
<a href="<?php echo $vkontakte; ?>" target="_blank" data-label="VKontakte" rel="noopener noreferrer nofollow" class="<?php echo $style; ?> vk tooltip" title="<?php _e('Follow on VKontakte','flatsome') ?>" aria-label="<?php esc_attr_e( 'Follow on VKontakte', 'flatsome' ); ?>"><?php echo get_flatsome_icon('icon-vk'); ?>
</a>
<?php }?>
<?php if($telegram){?>
<a href="<?php echo $telegram; ?>" target="_blank" data-label="Telegram" rel="noopener noreferrer nofollow" class="<?php echo $style; ?> telegram tooltip" title="<?php _e('Follow on Telegram','flatsome') ?>" aria-label="<?php esc_attr_e( 'Follow on Telegram', 'flatsome' ); ?>"><?php echo get_flatsome_icon('icon-telegram'); ?>
</a>
<?php }?>
<?php if($twitch){?>
<a href="<?php echo $twitch; ?>" target="_blank" data-label="Twitch" rel="noopener noreferrer nofollow" class="<?php echo $style; ?> twitch tooltip" title="<?php _e('Follow on Twitch','flatsome') ?>" aria-label="<?php esc_attr_e( 'Follow on Twitch', 'flatsome' ); ?>"><?php echo get_flatsome_icon('icon-twitch'); ?>
</a>
<?php }?>
<?php if($discord){?>
<a href="<?php echo $discord; ?>" target="_blank" data-label="Discord" rel="noopener noreferrer nofollow" class="<?php echo $style; ?> discord tooltip" title="<?php _e('Follow on Discord','flatsome') ?>" aria-label="<?php esc_attr_e( 'Follow on Discord', 'flatsome' ); ?>"><?php echo get_flatsome_icon('icon-discord'); ?>
</a>
<?php }?>
</div>
<?php
$content = ob_get_contents();
ob_end_clean();
$content = flatsome_sanitize_whitespace_chars( $content);
return $content;
}
add_shortcode("follow", "flatsome_follow");

View File

@@ -0,0 +1,80 @@
<?php
// [tabgroup]
function ux_tabgroup( $params, $content = null, $tag = '' ) {
$GLOBALS['tabs'] = array();
$GLOBALS['tab_count'] = 0;
$i = 1;
extract(shortcode_atts(array(
'id' => 'panel-'.rand(),
'title' => '',
'style' => 'line',
'align' => 'left',
'class' => '',
'visibility' => '',
'type' => '', // horizontal, vertical
'nav_style' => 'uppercase',
'nav_size' => 'normal',
'history' => 'false',
'event' => '',
), $params));
if($tag == 'tabgroup_vertical'){
$type = 'vertical';
}
$content = do_shortcode( $content );
$wrapper_class[] = 'tabbed-content';
if ( $class ) $wrapper_class[] = $class;
if ( $visibility ) $wrapper_class[] = $visibility;
$classes[] = 'nav';
if($style) $classes[] = 'nav-'.$style;
if($type == 'vertical') $classes[] = 'nav-vertical';
if($nav_style) $classes[] = 'nav-'.$nav_style;
if($nav_size) $classes[] = 'nav-size-'.$nav_size;
if($align) $classes[] = 'nav-'.$align;
if($event) $classes[] = 'active-on-' . $event;
$classes = implode(' ', $classes);
$return = '';
if( is_array( $GLOBALS['tabs'] )){
foreach( $GLOBALS['tabs'] as $key => $tab ){
if($tab['title']) $id = flatsome_to_dashed($tab['title']);
$active = $key == 0 ? ' active' : ''; // Set first tab active by default.
$tabs[] = '<li class="tab'.$active.' has-icon"><a href="#tab_'.$id.'"><span>'.$tab['title'].'</span></a></li>';
$panes[] = '<div class="panel'.$active.' entry-content" id="tab_'.$id.'">'.do_shortcode( $tab['content'] ).'</div>';
$i++;
}
if($title) $title = '<h4 class="uppercase text-'.$align.'">'.$title.'</h4>';
$return = '
<div class="'.implode(' ', $wrapper_class).'">
'.$title.'
<ul class="'.$classes.'">'.implode( "\n", $tabs ).'</ul><div class="tab-panels">'.implode( "\n", $panes ).'</div></div>';
}
return $return;
}
function ux_tab( $params, $content = null) {
extract(shortcode_atts(array(
'title' => '',
'title_small' => ''
), $params));
$x = $GLOBALS['tab_count'];
$GLOBALS['tabs'][$x] = array( 'title' => sprintf( $title, $GLOBALS['tab_count'] ), 'content' => $content );
$GLOBALS['tab_count']++;
}
add_shortcode('tabgroup', 'ux_tabgroup');
add_shortcode('tabgroup_vertical', 'ux_tabgroup');
add_shortcode('tab', 'ux_tab' );

View File

@@ -0,0 +1,149 @@
<?php
function flatsome_team_member($atts, $content = null){
extract( shortcode_atts( array(
'_id' => null,
'class' => '',
'visibility' => '',
'img' => '',
'name' => '',
'title' => '',
'icon_style' => 'outline',
'twitter' => '',
'facebook' => '',
'pinterest' => '',
'instagram' => '',
'tiktok' => '',
'snapchat' => '',
'youtube' => '',
'email' => '',
'phone' => '',
'linkedin' => '',
'telegram' => '',
'twitch' => '',
'discord' => '',
'style' => '',
'depth' => '',
'depth_hover' => '',
'link' => '',
'target' => '',
'rel' => '',
// Box styles
'animate' => '',
'text_pos' => 'bottom',
'text_padding' => '',
'text_bg' => '',
'text_color' => '',
'text_hover' => '',
'text_align' => 'center',
'text_size' => '',
'image_size' => '',
'image_width' => '',
'image_radius' => '',
'image_height' => '100%',
'image_hover' => '',
'image_hover_alt' => '',
'image_overlay' => '',
), $atts ) );
ob_start();
// Set Classes
$classes_box = array();
$classes_text = array();
$classes_image = array();
$classes_image_inner = array();
if ( $class ) $classes_box[] = $class;
if ( $visibility ) $classes_box[] = $visibility;
$link_atts = array(
'target' => $target,
'rel' => array( $rel ),
);
// Fix old
if($style == 'text-overlay'){
$image_hover = 'zoom';
}
$style = str_replace('text-', '', $style);
// Set box style
$classes_box[] = 'has-hover';
if($depth) $classes_box[] = 'box-shadow-'.$depth;
if($depth_hover) $classes_box[] = 'box-shadow-'.$depth_hover.'-hover';
$link_start = '<a href="' . $link . '"' . flatsome_parse_target_rel( $link_atts ) . '>';
$link_end = '</a>';
if($style) $classes_box[] = 'box-'.$style;
if($style == 'overlay') $classes_box[] = 'dark';
if($style == 'shade') $classes_box[] = 'dark';
if($style == 'badge') $classes_box[] = 'hover-dark';
if($text_pos) $classes_box[] = 'box-text-'.$text_pos;
if($style == 'overlay' && !$image_overlay) $image_overlay = 'rgba(0,0,0,.2)';
if($image_hover) $classes_image[] = 'image-'.$image_hover;
if($image_hover_alt) $classes_image[] = 'image-'.$image_hover_alt;
if($image_height) $classes_image_inner[] = 'image-cover';
// Text classes
if($text_hover) $classes_text[] = 'show-on-hover hover-'.$text_hover;
if($text_align) $classes_text[] = 'text-'.$text_align;
if($text_size) $classes_text[] = 'is-'.$text_size;
if($text_color == 'dark') $classes_text[] = 'dark';
if($animate) {$animate = 'data-animate="'.$animate.'"';}
$css_args = array(
array( 'attribute' => 'background-color', 'value' => $text_bg ),
array( 'attribute' => 'padding', 'value' => $text_padding ),
);
$css_image = array(
array( 'attribute' => 'width', 'value' => $image_width,'unit' => '%' ),
);
$css_image_inner = array(
array( 'attribute' => 'border-radius', 'value' => $image_radius,'unit' => '%' ),
array( 'attribute' => 'padding-top', 'value' => $image_height),
);
$has_custom_social_link = $facebook || $instagram || $tiktok || $twitter || $youtube || $email || $phone || $pinterest || $linkedin || $snapchat || $telegram || $twitch || $discord;
?>
<div class="box has-hover <?php echo implode(' ', $classes_box); ?>" <?php echo $animate; ?>>
<?php if($link) echo $link_start; ?>
<div class="box-image <?php echo implode(' ', $classes_image); ?>" <?php echo get_shortcode_inline_css($css_image); ?>>
<div class="box-image-inner <?php echo implode(' ', $classes_image_inner); ?>" <?php echo get_shortcode_inline_css($css_image_inner); ?>>
<?php echo flatsome_get_image($img, $image_size); ?>
<?php if($image_overlay) { ?><div class="overlay" style="background-color:<?php echo $image_overlay; ?>"></div><?php } ?>
</div>
</div>
<?php if($link) echo $link_end; ?>
<div class="box-text <?php echo implode(' ', $classes_text); ?>" <?php echo get_shortcode_inline_css($css_args); ?>>
<div class="box-text-inner">
<h4 class="uppercase">
<span class="person-name"><?php echo $name; ?></span><br/>
<span class="person-title is-small thin-font op-7">
<?php echo $title; ?>
</span>
</h4>
<?php if( $has_custom_social_link ) echo do_shortcode('[follow style="'.$icon_style.'" facebook="'.$facebook.'" twitter="'.$twitter.'" snapchat="'.$snapchat.'" email="'.$email.'" phone="'.$phone.'" pinterest="'.$pinterest.'" youtube="'.$youtube.'" instagram="'.$instagram.'" tiktok="'.$tiktok.'" linkedin="'.$linkedin.'" telegram="'.$telegram.'" twitch="'.$twitch.'" discord="'.$discord.'"]'); ?>
<?php if($style !== 'overlay' && $style !== 'shade') echo do_shortcode($content); ?>
</div>
</div>
</div>
<?php if($style == 'overlay' || $style == 'shade') echo '<div class="team-member-content pt-half text-'.$text_align.'">'.$content.'</div>'; ?>
<?php
$content = ob_get_contents();
ob_end_clean();
return $content;
};
add_shortcode('team_member','flatsome_team_member');

View File

@@ -0,0 +1,71 @@
<?php
// [testimonial]
function flatsome_testimonial($atts, $content = null) {
global $flatsome_opt;
$sliderrandomid = rand();
extract(shortcode_atts(array(
'name' => '',
'class' => '',
'visibility' => '',
'company' => '',
'stars' => '5',
'font_size' => '',
'text_align' => '',
'image' => '',
'image_width' => '80',
'pos' => 'left',
'link' => '',
), $atts));
ob_start();
$classes = array('testimonial-box');
$classes_img = array('icon-box-img','testimonial-image','circle');
$classes[] = 'icon-box-'.$pos;
if ( $class ) $classes[] = $class;
if ( $visibility ) $classes[] = $visibility;
if($pos == 'center') $classes[] = 'text-center';
if($pos == 'left' || $pos == 'top') $classes[] = 'text-left';
if($pos == 'right') $classes[] = 'text-right';
if($font_size) $classes[] = 'is-'.$font_size;
if($image_width) $image_width = 'width: '.intval($image_width).'px';
$star_row = '';
if ($stars == '1'){$star_row = '<div class="star-rating"><span style="width:25%"><strong class="rating"></strong></span></div>';}
else if ($stars == '2'){$star_row = '<div class="star-rating"><span style="width:35%"><strong class="rating"></strong></span></div>';}
else if ($stars == '3'){$star_row = '<div class="star-rating"><span style="width:55%"><strong class="rating"></strong></span></div>';}
else if ($stars == '4'){$star_row = '<div class="star-rating"><span style="width:75%"><strong class="rating"></strong></span></div>';}
else if ($stars == '5'){$star_row = '<div class="star-rating"><span style="width:100%"><strong class="rating"></strong></span></div>';}
$classes = implode(" ", $classes);
$classes_img = implode(" ", $classes_img);
?>
<div class="icon-box <?php echo $classes; ?>">
<?php if($image) { ?>
<div class="<?php echo $classes_img; ?>" style="<?php if($image_width) echo $image_width; ?>">
<?php echo flatsome_get_image($image, $size = 'thumbnail', $alt = $name) ;?>
</div>
<?php } ?>
<div class="icon-box-text p-last-0">
<?php if($stars > 0) echo $star_row; ?>
<div class="testimonial-text line-height-small italic test_text first-reset last-reset is-italic">
<?php echo do_shortcode( $content ); ?>
</div>
<div class="testimonial-meta pt-half">
<strong class="testimonial-name test_name"><?php echo $name; ?></strong>
<?php if($name && $company) echo '<span class="testimonial-name-divider"> / </span>'; ?>
<span class="testimonial-company test_company"><?php echo $company; ?></span>
</div>
</div>
</div>
<?php
$content = ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode("testimonial", "flatsome_testimonial");

View File

@@ -0,0 +1,155 @@
<?php
function flatsome_text_box( $atts, $content = null ){
$atts = shortcode_atts( array(
'id' => 'text-box-'.rand(),
'style' => '',
'res_text' => 'true',
'hover' => '',
'position_x' => '50',
'position_x__sm' => '',
'position_x__md' => '',
'position_y' => '50',
'position_y__sm' => '',
'position_y__md' => '',
'text_color' => 'light',
'bg' => '',
'width' => '60',
'width__sm' => '',
'width__md' => '',
'height' => '',
'height__sm' => '',
'height__md' => '',
'scale' => '100',
'scale__sm' => '',
'scale__md' => '',
'text_align' => 'center',
'animate' => '',
'parallax' => '',
'padding' => '',
'padding__sm' => '',
'padding__md' => '',
'margin' => '',
'margin__sm' => '',
'margin__md' => '',
'radius' => '',
'rotate' => '',
'class' => '',
'visibility' => '',
'border_radius' => '',
// Borders
'border' => '',
'border_color' => '',
'border_style' => '',
'border_pos' => '',
// Depth
'depth' => '',
'depth_hover' => '',
// Text depth
'text_depth' => '',
// Border
'border' => '',
'border_color' => '',
'border_margin' => '',
'border_radius' => '',
'border_style' => '',
'border_hover' => '',
), $atts );
extract( $atts );
ob_start();
$classes[] = 'text-box banner-layer';
$classes_text = array('text-inner');
if($style) $classes[] = 'text-box-'.$style;
if($class) $classes[] = $class;
if($visibility) $classes[] = $visibility;
// Set positions
$classes[] = flatsome_position_classes( 'x', $position_x, $position_x__sm, $position_x__md );
$classes[] = flatsome_position_classes( 'y', $position_y, $position_y__sm, $position_y__md );
$classes_inner = array();
if($depth) $classes_inner[] = 'box-shadow-'.$depth;
if($depth_hover) $classes_inner[] = 'box-shadow-'.$depth_hover.'-hover';
if($text_color == 'light') {$classes_inner[] = 'dark';}
if($text_depth) {$classes_inner[] = "text-shadow-".$text_depth;}
if($text_align) {$classes_text[] = "text-".$text_align;}
if($parallax) $parallax = 'data-parallax="'.$parallax.'" data-parallax-fade="true"';
/* Responive text */
if($res_text) $classes[] = 'res-text';
$classes_text = implode(" ", $classes_text);
$classes_inner = implode(" ", $classes_inner);
$classes = implode(" ", $classes);
?>
<div id="<?php echo $id; ?>" class="<?php echo $classes; ?>">
<?php if($hover) echo '<div class="hover-'.$hover.'">'; ?>
<?php if($parallax) echo '<div '.$parallax.'>'; ?>
<?php if($animate) echo '<div data-animate="'.$animate.'">'; ?>
<div class="text-box-content text <?php echo $classes_inner; ?>">
<?php require( __DIR__ . '/commons/border.php' ) ;?>
<div class="<?php echo $classes_text; ?>">
<?php echo do_shortcode( $content ); ?>
</div>
</div>
<?php if($animate) echo '</div>'; ?>
<?php if($parallax) echo '</div>'; ?>
<?php if($hover) echo '</div>'; ?>
<?php
$args = array(
'margin' => array(
'selector' => '',
'property' => 'margin',
),
'bg' => array(
'selector' => '.text-box-content',
'property' => 'background-color',
),
'padding' => array(
'selector' => '.text-inner',
'property' => 'padding',
),
'radius' => array(
'selector' => '.text-box-content',
'property' => 'border-radius',
'unit' => 'px',
),
'width' => array(
'selector' => '',
'property' => 'width',
'unit' => '%',
),
'height' => array(
'selector' => '',
'property' => 'height',
'unit' => '%',
),
'scale' => array(
'selector' => '.text-box-content',
'property' => 'font-size',
'unit' => '%',
),
'rotate' => array(
'selector' => '.text-box-content',
'property' => 'rotate',
'unit' => 'deg',
),
);
echo ux_builder_element_style_tag( $id, $args, $atts);
?>
</div>
<?php
$content = ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode('text_box', 'flatsome_text_box');

View File

@@ -0,0 +1,99 @@
<?php
// [title]
function title_shortcode( $atts, $content = null ){
extract( shortcode_atts( array(
'_id' => 'title-'.rand(),
'class' => '',
'visibility' => '',
'text' => 'Lorem ipsum dolor sit amet...',
'tag_name' => 'h3',
'sub_text' => '',
'style' => 'normal',
'size' => '100',
'link' => '',
'link_text' => '',
'target' => '',
'margin_top' => '',
'margin_bottom' => '',
'letter_case' => '',
'color' => '',
'width' => '',
'icon' => '',
), $atts ) );
$classes = array('container', 'section-title-container');
if ( $class ) $classes[] = $class;
if ( $visibility ) $classes[] = $visibility;
$classes = implode(' ', $classes);
$link_output = '';
if($link) $link_output = '<a href="'.$link.'" target="'.$target.'">'.$link_text.get_flatsome_icon('icon-angle-right').'</a>';
$small_text = '';
if($sub_text) $small_text = '<small class="sub-title">'.$atts['sub_text'].'</small>';
if($icon) $icon = get_flatsome_icon($icon);
// fix old
if($style == 'bold_center') $style = 'bold-center';
$css_args = array(
array( 'attribute' => 'margin-top', 'value' => $margin_top),
array( 'attribute' => 'margin-bottom', 'value' => $margin_bottom),
);
if($width) {
$css_args[] = array( 'attribute' => 'max-width', 'value' => $width);
}
$css_args_title = array();
if($size !== '100'){
$css_args_title[] = array( 'attribute' => 'font-size', 'value' => $size, 'unit' => '%');
}
if($color){
$css_args_title[] = array( 'attribute' => 'color', 'value' => $color);
}
return '<div class="'.$classes.'" '.get_shortcode_inline_css($css_args).'><'. $tag_name . ' class="section-title section-title-'.$style.'"><b></b><span class="section-title-main" '.get_shortcode_inline_css($css_args_title).'>'.$icon.$text.$small_text.'</span><b></b>'.$link_output.'</' . $tag_name .'></div>';
}
add_shortcode('title', 'title_shortcode');
// [divider]
function divider_shortcode( $atts, $content = null ){
extract( shortcode_atts( array(
'width' => '',
'height' => '',
'margin' => '',
'align' => '',
'color' => '',
), $atts ) );
$align_end ='';
$align_start = '';
// Fallback
if($width == 'full') $width = '100%';
$css_args = array(
array( 'attribute' => 'margin-top', 'value' => $margin),
array( 'attribute' => 'margin-bottom', 'value' => $margin),
array( 'attribute' => 'max-width', 'value' => $width ),
array( 'attribute' => 'height', 'value' => $height ),
array( 'attribute' => 'background-color', 'value' => $color ),
);
if($align === 'center'){
$align_start ='<div class="text-center">';
$align_end = '</div>';
}
if($align === 'right'){
$align_start ='<div class="text-right">';
$align_end = '</div>';
}
return $align_start.'<div class="is-divider divider clearfix" '.get_shortcode_inline_css($css_args).'></div>'.$align_end;
}
add_shortcode('divider', 'divider_shortcode');

View File

@@ -0,0 +1,262 @@
<?php
// [ux_banner]
function flatsome_ux_banner( $atts, $content = null ){
extract( $atts = shortcode_atts( array(
'_id' => 'banner-' . rand(),
'visibility' => '',
// Layout.
'hover' => '',
'hover_alt' => '',
'alt' => '',
'class' => '',
'sticky' => '',
'height' => '',
'height__sm' => '',
'height__md' => '',
'container_width' => '',
'mob_height' => '', // Deprecated.
'tablet_height' => '', // Deprecated.
// Background.
'bg' => '',
'parallax' => '',
'parallax_style' => '',
'slide_effect' => '',
'bg_size' => 'large',
'bg_color' => '',
'bg_overlay' => '',
'bg_overlay__sm' => '',
'bg_overlay__md' => '',
'bg_pos' => '',
'effect' => '',
// Shape divider.
'divider_top' => '',
'divider_top_height' => '150px',
'divider_top_height__sm' => null,
'divider_top_height__md' => null,
'divider_top_width' => '100',
'divider_top_width__sm' => null,
'divider_top_width__md' => null,
'divider_top_fill' => '',
'divider_top_flip' => 'false',
'divider_top_to_front' => 'false',
'divider' => '',
'divider_height' => '150px',
'divider_height__sm' => null,
'divider_height__md' => null,
'divider_width' => '100',
'divider_width__sm' => null,
'divider_width__md' => null,
'divider_fill' => '',
'divider_flip' => 'false',
'divider_to_front' => 'false',
// Video.
'video_mp4' => '',
'video_ogg' => '',
'video_webm' => '',
'video_sound' => 'false',
'video_loop' => 'true',
'youtube' => '',
'video_visibility' => 'hide-for-medium',
// Border Control.
'border' => '',
'border_color' => '',
'border_margin' => '',
'border_radius' => '',
'border_style' => '',
'border_hover' => '',
// Deprecated (This is added to Text Box shortcode).
'animation' => 'fadeIn',
'animate' => '',
'loading' => '',
'animated' => '',
'animation_duration' => '',
'text_width' => '60%',
'text_align' => 'center',
'text_color' => 'light',
'text_pos' => 'center',
'parallax_text' => '',
'text_bg' => '',
'padding' => '',
// Link.
'link' => '',
'target' => '',
'rel' => '',
), $atts ) );
// Stop if visibility is hidden.
if($visibility == 'hidden') return;
ob_start();
$classes = array( 'has-hover' );
$link_atts = array(
'target' => $target,
'rel' => array( $rel ),
);
// Custom Class.
if($class) $classes[] = $class;
if($animate) {$animation = $animate;}
if($animated) {$animation = $animated;}
/* Hover Class */
if($hover) $classes[] = 'bg-'.$hover;
if($hover_alt) $classes[] = 'bg-'.$hover_alt;
/* Has video */
if($video_mp4 || $video_webm || $video_ogg) { $classes[] = 'has-video'; }
/* Sticky */
if($sticky) $classes[] = 'sticky-section';
/* Banner Effects */
if($effect) wp_enqueue_style( 'flatsome-effects');
/* Old bg fallback */
$atts['bg_color'] = $bg_color;
if(strpos($bg,'#') !== false){
$atts['bg_color'] = $bg;
$bg = false;
}
/* Mute if video_sound is 0 (should stay to support old versions have checkbox option for video sound) */
if ( $video_sound == '0' ) $video_sound = 'false';
if($bg_overlay && strpos($bg_overlay,'#') !== false){
$atts['bg_overlay'] = flatsome_hex2rgba($bg_overlay,'0.15');
}
/* Full height banner */
if(strpos($height, '100%') !== false) {
$classes[] = 'is-full-height';
}
/* Slide Effects */
if($slide_effect) $classes[] = 'has-slide-effect slide-'.$slide_effect;
/* Visibility */
if($visibility) $classes[] = $visibility;
/* Links */
$start_link = "";
$end_link = "";
if($link) {$start_link = '<a class="fill" href="'.$link.'"' . flatsome_parse_target_rel( $link_atts ) . '>'; $end_link = '</a>';};
/* Parallax */
if($parallax){
$classes[] = 'has-parallax';
$parallax = 'data-parallax="-'.$parallax.'" data-parallax-container=".banner" data-parallax-background';
}
/* Lazy load */
$lazy_load = get_theme_mod('lazy_load_backgrounds', 1) ? '' : 'bg-loaded';
$classes = implode(" ", $classes);
?>
<div class="banner <?php echo $classes; ?>" id="<?php echo $_id; ?>">
<?php if($loading) echo '<div class="loading-spin dark centered"></div>'; ?>
<div class="banner-inner fill">
<div class="banner-bg fill" <?php echo $parallax; ?>>
<div class="bg fill bg-fill <?php echo $lazy_load; ?>"></div>
<?php require( __DIR__ . '/commons/video.php' ) ;?>
<?php if($bg_overlay) echo '<div class="overlay"></div>' ?>
<?php require( __DIR__ . '/commons/border.php' ) ;?>
<?php if($effect) echo '<div class="effect-'.$effect.' bg-effect fill no-click"></div>'; ?>
</div>
<?php require __DIR__ . '/commons/shape-divider.php'; ?>
<div class="banner-layers <?php if($container_width !== 'full-width') echo 'container'; ?>">
<?php echo $start_link; ?><div class="fill banner-link"></div><?php echo $end_link; ?>
<?php
// Get Layers
if (!get_theme_mod('flatsome_fallback', 1) || (has_shortcode( $content, 'text_box' ) || has_shortcode( $content, 'ux_hotspot' ) || has_shortcode( $content, 'ux_image' ))) {
echo do_shortcode( $content );
} else {
$x = '50'; $y = '50';
if($text_pos !== 'center'){
$values = explode(' ', $text_pos);
if($values[0] == 'left' || $values[1] == 'left'){$x = '10';}
if($values[0] == 'right' || $values[1] == 'right'){$x = '90';}
if($values[0] == 'far-left' || $values[1] == 'far-left'){$x = '0';}
if($values[0] == 'far-right' || $values[1] == 'far-right'){$x = '100';}
if($values[0] == 'top' || $values[1] == 'top'){$y = '10';}
if($values[0] == 'bottom' || $values[1] == 'bottom'){$y = '90';}
}
if($text_bg && !$padding) $padding = '30px 30px 30px 30px';
$depth = '';
if($text_bg) $depth = '1';
echo do_shortcode( '[text_box text_align="'.$text_align.'" parallax="'.$parallax_text.'" animate="'.$animation.'" depth="'.$depth.'" padding="'.$padding.'" bg="'.$text_bg.'" text_color="'.$text_color.'" width="'.intval($text_width).'" width__sm="60%" position_y="'.$y.'" position_x="'.$x.'"]'.$content.'[/text_box]' );
} ?>
</div>
</div>
<?php
// Add invisible image if height is not set.
if(!$height) { ?>
<div class="height-fix is-invisible"><?php if($bg) echo flatsome_get_image($bg, $bg_size, $alt, true); ?></div>
<?php } ?>
<?php
// Get custom CSS
$args = array(
'height' => array(
'selector' => '',
'property' => 'padding-top',
),
'bg' => array(
'selector' => '.bg.bg-loaded',
'property' => 'background-image',
'size' => $bg_size
),
'bg_overlay' => array(
'selector' => '.overlay',
'property' => 'background-color',
),
'bg_color' => array(
'selector' => '',
'property' => 'background-color',
),
'bg_pos' => array(
'selector' => '.bg',
'property' => 'background-position',
),
'divider_top_height' => array(
'selector' => '.ux-shape-divider--top svg',
'property' => 'height',
),
'divider_top_width' => array(
'selector' => '.ux-shape-divider--top svg',
'property' => '--divider-top-width',
'unit' => '%',
),
'divider_top_fill' => array(
'selector' => '.ux-shape-divider--top .ux-shape-fill',
'property' => 'fill',
),
'divider_height' => array(
'selector' => '.ux-shape-divider--bottom svg',
'property' => 'height',
),
'divider_width' => array(
'selector' => '.ux-shape-divider--bottom svg',
'property' => '--divider-width',
'unit' => '%',
),
'divider_fill' => array(
'selector' => '.ux-shape-divider--bottom .ux-shape-fill',
'property' => 'fill',
),
);
echo ux_builder_element_style_tag($_id, $args, $atts);
?>
</div>
<?php
$content = ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode('ux_banner', 'flatsome_ux_banner');

View File

@@ -0,0 +1,119 @@
<?php
// [ux_banner_grid]
function flatsome_banner_grid($atts, $content = null) {
extract( shortcode_atts( array(
'_id' => 'banner-grid-'.rand(),
'class' => '',
'visibility' => '',
'width' => '',
'height' => '600px',
'height__sm' => '',
'height__md' => '',
'spacing' => 'small',
'depth' => '',
'depth_hover' => '',
// Depricated
'padding' => '',
'grid' => '',
), $atts ) );
$classes = array('row','row-grid');
if ( $class ) $classes[] = $class;
if ( $visibility ) $classes[] = $visibility;
// Fix old
if($padding == '0px'){
$spacing = 'collapse';
}
if($padding == '15px'){
$spacing = 'small';
}
if($spacing !== 'normal') $classes[] = 'row-'.$spacing;
if($depth) $classes[] = 'row-box-shadow-'.$depth;
if($depth_hover) $classes[] = 'row-box-shadow-'.$depth_hover.'-hover';
if($width == 'full-width') $classes[] = 'row-full-width';
// Run masonry script
wp_enqueue_script( 'flatsome-masonry-js');
ob_start();
?>
<div class="banner-grid-wrapper">
<div id="<?php echo $_id; ?>" class="banner-grid <?php echo implode(' ', $classes); ?>" data-packery-options="">
<?php if(has_shortcode( $content, 'col_grid' ) || has_shortcode( $content, 'col' )) { ?>
<?php echo do_shortcode( $content ) ?>
<?php } else {
// Fix old content
$pattern = get_shortcode_regex();
$columns = 0;
$current_grid = 0;
$grid = flatsome_get_grid($grid);
$grid_total = count($grid);
flatsome_get_grid_height($height, $_id);
if (preg_match_all( '/'. $pattern .'/s', $content, $matches )
&& array_key_exists( 2, $matches )
&& in_array( 'ux_banner', $matches[2] ) ){
foreach ($matches[0] as $shortcode) {
if($grid_total > $current_grid) $current_grid++;
$current = $current_grid-1;
echo do_shortcode('[col_grid span="'.$grid[$current]['span'].'" span__md="'.$grid[$current]['md'].'" height="'.$grid[$current]['height'].'"]'.$shortcode.'[/col_grid]');
}
}
}
?>
</div>
<?php flatsome_get_grid_height(array($height, $height__md, $height__sm), $_id); ?>
</div>
<?php
// Get banner grid styles
$content = ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode('ux_banner_grid', 'flatsome_banner_grid');
// [col_grid]
function ux_grid_col($atts, $content = null) {
extract( shortcode_atts( array(
'span' => '12',
'span__md' => '',
'span__sm' => '',
'animate' => '',
'height' => '',
'class' => '',
'visibility' => '',
'depth' => '',
'depth_hover' => '',
), $atts ) );
$classes[] = 'col grid-col';
$classes_inner[] = 'col-inner';
if($span__md) $classes[] = 'medium-'.$span__md;
if($span__sm) $classes[] = 'small-'.$span__sm;
if($span) $classes[] = 'large-'.$span;
$classes[] = $height ? 'grid-col-'.$height : 'grid-col-1';
// Add Animation Class
if($animate) { $animate = 'data-animate="'.$animate.'"'; }
if ( $class ) $classes[] = $class;
if ( $visibility ) $classes[] = $visibility;
// Add Depth Class
if($depth) $classes_inner[] = 'box-shadow-'.$depth;
if($depth_hover) $classes_inner[] = 'box-shadow-'.$depth_hover.'-hover';
$classes = implode(" ", $classes);
$classes_inner = implode(" ", $classes_inner);
$column = '<div class="'.$classes.'" '.$animate.'><div class="'.$classes_inner.'">'.$content.'</div></div>';
return do_shortcode( $column );
}
add_shortcode('col_grid', 'ux_grid_col');

View File

@@ -0,0 +1,3 @@
//http://hilios.github.io/jQuery.countdown/
!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){"use strict";function b(a){if(a instanceof Date)return a;if(String(a).match(g))return String(a).match(/^[0-9]*$/)&&(a=Number(a)),String(a).match(/\-/)&&(a=String(a).replace(/\-/g,"/")),new Date(a);throw new Error("Couldn't cast `"+a+"` to a date object.")}function c(a){var b=a.toString().replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");return new RegExp(b)}function d(a){return function(b){var d=b.match(/%(-|!)?[A-Z]{1}(:[^;]+;)?/gi);if(d)for(var f=0,g=d.length;g>f;++f){var h=d[f].match(/%(-|!)?([a-zA-Z]{1})(:[^;]+;)?/),j=c(h[0]),k=h[1]||"",l=h[3]||"",m=null;h=h[2],i.hasOwnProperty(h)&&(m=i[h],m=Number(a[m])),null!==m&&("!"===k&&(m=e(l,m)),""===k&&10>m&&(m="0"+m.toString()),b=b.replace(j,m.toString()))}return b=b.replace(/%%/,"%")}}function e(a,b){var c="s",d="";return a&&(a=a.replace(/(:|;|\s)/gi,"").split(/\,/),1===a.length?c=a[0]:(d=a[0],c=a[1])),1===Math.abs(b)?d:c}var f=[],g=[],h={precision:100,elapse:!1};g.push(/^[0-9]*$/.source),g.push(/([0-9]{1,2}\/){2}[0-9]{4}( [0-9]{1,2}(:[0-9]{2}){2})?/.source),g.push(/[0-9]{4}([\/\-][0-9]{1,2}){2}( [0-9]{1,2}(:[0-9]{2}){2})?/.source),g=new RegExp(g.join("|"));var i={Y:"years",m:"months",n:"daysToMonth",w:"weeks",d:"daysToWeek",D:"totalDays",H:"hours",M:"minutes",S:"seconds"},j=function(b,c,d){this.el=b,this.$el=a(b),this.interval=null,this.offset={},this.options=a.extend({},h),this.instanceNumber=f.length,f.push(this),this.$el.data("countdown-instance",this.instanceNumber),d&&("function"==typeof d?(this.$el.on("update.countdown",d),this.$el.on("stoped.countdown",d),this.$el.on("finish.countdown",d)):this.options=a.extend({},h,d)),this.setFinalDate(c),this.start()};a.extend(j.prototype,{start:function(){null!==this.interval&&clearInterval(this.interval);var a=this;this.update(),this.interval=setInterval(function(){a.update.call(a)},this.options.precision)},stop:function(){clearInterval(this.interval),this.interval=null,this.dispatchEvent("stoped")},toggle:function(){this.interval?this.stop():this.start()},pause:function(){this.stop()},resume:function(){this.start()},remove:function(){this.stop.call(this),f[this.instanceNumber]=null,delete this.$el.data().countdownInstance},setFinalDate:function(a){this.finalDate=b(a)},update:function(){if(0===this.$el.closest("html").length)return void this.remove();var b,c=void 0!==a._data(this.el,"events"),d=new Date;b=this.finalDate.getTime()-d.getTime(),b=Math.ceil(b/1e3),b=!this.options.elapse&&0>b?0:Math.abs(b),this.totalSecsLeft!==b&&c&&(this.totalSecsLeft=b,this.elapsed=d>=this.finalDate,this.offset={seconds:this.totalSecsLeft%60,minutes:Math.floor(this.totalSecsLeft/60)%60,hours:Math.floor(this.totalSecsLeft/60/60)%24,days:Math.floor(this.totalSecsLeft/60/60/24)%7,daysToWeek:Math.floor(this.totalSecsLeft/60/60/24)%7,daysToMonth:Math.floor(this.totalSecsLeft/60/60/24%30.4368),totalDays:Math.floor(this.totalSecsLeft/60/60/24),weeks:Math.floor(this.totalSecsLeft/60/60/24/7),months:Math.floor(this.totalSecsLeft/60/60/24/30.4368),years:Math.abs(this.finalDate.getFullYear()-d.getFullYear())},this.options.elapse||0!==this.totalSecsLeft?this.dispatchEvent("update"):(this.stop(),this.dispatchEvent("finish")))},dispatchEvent:function(b){var c=a.Event(b+".countdown");c.finalDate=this.finalDate,c.elapsed=this.elapsed,c.offset=a.extend({},this.offset),c.strftime=d(this.offset),this.$el.trigger(c)}}),a.fn.countdown=function(){var b=Array.prototype.slice.call(arguments,0);return this.each(function(){var c=a(this).data("countdown-instance");if(void 0!==c){var d=f[c],e=b[0];j.prototype.hasOwnProperty(e)?d[e].apply(d,b.slice(1)):null===String(e).match(/^[$A-Z_][0-9A-Z_$]*$/i)?(d.setFinalDate.call(d,e),d.start()):a.error("Method %s does not exist on jQuery.countdown".replace(/\%s/gi,e))}else new j(this,b[0],b[1])})}});

View File

@@ -0,0 +1,40 @@
/* UX Countdown Shortcode Styles */
.ux-timer{
width:100%;
position:relative;
border-spacing: 5px;
margin: .3em 0 .2em;
font-size: 300%;
display: table;
table-layout: fixed;
}
.ux-timer span{
display:table-cell;
font-weight: bolder;
text-align: center;
color:#FFF;
line-height: 80%;
padding: .4em .1em .1em;
margin:0 .05em .2em;
border-radius: 5px;
background-color: rgba(0,0,0,.85);
}
.ux-timer span strong{
font-family: 'Helvetica' Sans-serif;
font-size: 30%;
opacity: .7;
text-transform: uppercase;
display: block;
}
.ux-timer.light span{
background-color: rgba(255,255,255,.85);
color: #000;
}
.ux-timer-text span{
font-weight: bolder;
display: inline-block;
margin: 0 .35em
}
.ux-timer-text strong{
margin-left: .2em
}

View File

@@ -0,0 +1,44 @@
Flatsome.behavior('ux-countdown', {
attach: function (context) {
jQuery('[data-countdown]', context).each(function () {
var $this = jQuery(this), finalDate = jQuery(this).data('countdown');
var t_hour = jQuery(this).data('text-hour'),
t_min = jQuery(this).data('text-min'),
t_week = jQuery(this).data('text-week'),
t_day = jQuery(this).data('text-day'),
t_sec = jQuery(this).data('text-sec'),
t_min_p = jQuery(this).data('text-min-p'),
t_hour_p = jQuery(this).data('text-hour-p'),
t_week_p = jQuery(this).data('text-week-p'),
t_day_p = jQuery(this).data('text-day-p'),
t_sec_p = jQuery(this).data('text-sec-p'),
t_plural = jQuery(this).data('text-plural');
var hours_plural = t_hour+t_plural;
var days_plural = t_day+t_plural;
var weeks_plural = t_week+t_plural;
var min_plural = t_min;
var sec_plural = t_sec;
if(t_hour_p) hours_plural = t_hour_p;
if(t_min_p) min_plural = t_min_p;
if(t_week_p) weeks_plural = t_week_p;
if(t_day_p) days_plural = t_day_p;
if(t_sec_p) sec_plural = t_sec_p;
$this.countdown(finalDate).on('update.countdown', function (event) {
var format = '<span>%-H<strong>%!H:'+t_hour+','+hours_plural+';</strong></span><span>%-M<strong>%!M:'+t_min+','+min_plural+';</strong></span><span>%-S<strong>%!S:'+t_sec+','+sec_plural+';</strong></span>';
if(event.offset.days > 0) { format = '<span>%-d<strong>%!d:'+t_day+','+days_plural+';</strong></span>' + format; }
if(event.offset.weeks > 0) { format = '<span>%-w<strong>%!w:'+t_week+','+weeks_plural+';</strong></span>' + format; }
jQuery(this).html(event.strftime(format));
}).on('finish.countdown', function (event) {
var format = '<span>%-H<strong>%!H:'+t_hour+','+hours_plural+';</strong></span><span>%-M<strong>%!M:'+t_min+','+min_plural+';</strong></span><span>%-S<strong>%!S:'+t_sec+','+sec_plural+';</strong></span>';
jQuery(this).html(event.strftime(format));
});
});
}
});

View File

@@ -0,0 +1,83 @@
<?php
// Register scripts
function flatsome_countdown_shortcode_scripts() {
wp_register_style( 'flatsome-countdown-style', get_template_directory_uri() . '/inc/shortcodes/ux_countdown/ux-countdown.css', 'flatsome-style');
wp_register_script( 'flatsome-countdown-script', get_template_directory_uri() . '/inc/shortcodes/ux_countdown/countdown-script-min.js', 'flatsome-countdown-script');
wp_register_script( 'flatsome-countdown-theme-js', get_template_directory_uri() . '/inc/shortcodes/ux_countdown/ux-countdown.js', 'flatsome-js', '3.2.6', true);
}
add_action( 'wp_enqueue_scripts', 'flatsome_countdown_shortcode_scripts' );
// Register Shortcode
function ux_countdown_shortcode( $atts ){
$atts = shortcode_atts( array(
'_id' => 'timer-'.rand(),
'before' => '',
'after' => '',
'year' => '2021',
'month' => '12',
'day' => '31',
'color' => 'dark',
'bg_color' => '',
'bg_color__md' => '',
'bg_color__sm' => '',
'time' => '18:00',
'style' => 'clock',
'size' => '300',
'size__md' => '',
'size__sm' => '',
't_hour' => 'hour',
't_min' => 'min',
't_day' => 'day',
't_week' => 'week',
't_sec' => 'sec',
//
't_plural' => 's',
't_hour_p' => '',
't_min_p' => '',
't_day_p' => '',
't_week_p' => '',
't_sec_p' => '',
), $atts );
extract( $atts );
wp_enqueue_style('flatsome-countdown-style');
wp_enqueue_script('flatsome-countdown-script');
wp_enqueue_script('flatsome-countdown-theme-js');
$date = $year.'/'.$month.'/'.$day;
// Fix Time
if($time == '24:00') $time = '23:59:59';
if($time) $date = $date.' '.$time;
$args = array(
'size' => array(
'selector' => '',
'unit' => '%',
'property' => 'font-size',
),
'bg_color' => array(
'selector' => 'span',
'property' => 'background-color',
),
);
// data-text-hour-p="'.$t_hour_p.'" data-text-day-p="'.$t_day_p.'" data-text-week-p="'.$t_week_p.'" data-text-min-p="'.$t_min_p.'" data-text-sec-p="'.$t_sec_p.'"
// Texts
$translations = 'data-text-plural="'.$t_plural.'" data-text-hour="'.$t_hour.'" data-text-day="'.$t_day.'" data-text-week="'.$t_week.'" data-text-min="'.$t_min.'" data-text-sec="'.$t_sec.'"';
// Add plurals
if(isset($t_hour_p) || isset($t_day_p)) {
$translations = $translations.' '.'data-text-hour-p="'.$t_hour_p.'" data-text-day-p="'.$t_day_p.'" data-text-week-p="'.$t_week_p.'" data-text-min-p="'.$t_min_p.'" data-text-sec-p="'.$t_sec_p.'"';
}
if($style == 'clock'){
return $before.'<div id="'.$_id.'" class="ux-timer '.$color.'" '.$translations.' data-countdown="'.$date.'"><span>&nbsp;<div class="loading-spin dark centered"></div><strong>&nbsp;</strong></span></div>'.ux_builder_element_style_tag($_id, $args, $atts).$after;
} else{
return $before.'<span id="'.$_id.'" class="ux-timer-text" '.$translations.' data-countdown="'.$date.'"></span>'.ux_builder_element_style_tag($_id, $args, $atts).''.$after;
}
}
add_shortcode('ux_countdown', 'ux_countdown_shortcode');

View File

@@ -0,0 +1,230 @@
<?php
function ux_gallery($atts) {
extract(shortcode_atts(array(
// meta
'_id' => 'gallery-'.rand(),
'class' => '',
'visibility' => '',
'ids' => '', // Gallery IDS
'lightbox' => true,
'lightbox_image_size' => 'large',
'thumbnails' => true,
'orderby' => 'post__in',
'order' => '',
// Layout
'style' => 'overlay',
'columns' => '4',
'columns__sm' => '',
'columns__md' => '',
'col_spacing' => '',
'type' => '', // slider, row, masonery, grid
'width' => '',
'grid' => '1',
'grid_height' => '600px',
'slider_nav_style' => 'reveal',
'slider_bullets' => 'false',
'slider_nav_position' => '',
'slider_nav_color' => '',
'slider_arrows' => 'true',
'auto_slide' => 'false',
'infinitive' => 'true',
'depth' => '',
'depth_hover' => '',
// Box styles
'animate' => '',
'text_pos' => '',
'text_padding' => '',
'text_bg' => '',
'text_color' => '',
'text_hover' => '',
'text_align' => 'left',
'text_size' => '',
'image_size' => 'medium',
'image_mask' => '',
'image_width' => '',
'image_height' => '',
'image_radius' => '',
'image_hover' => '',
'image_hover_alt' => '',
'image_overlay' => '',
), $atts));
ob_start();
$classes = explode( ' ', $class );
$classes_box = array('box','has-hover','gallery-box');
$classes_image = array('box-image');
$classes_text = array('box-text');
// Create Grid
if($type == 'grid'){
if(!$text_pos) $text_pos = 'center';
if(!$text_color) $text_color = 'dark';
if($style !== 'shade') $style = 'overlay';
$columns = null;
$current_grid = 0;
$grid = flatsome_get_grid($grid);
$grid_total = count($grid);
flatsome_get_grid_height($grid_height, $_id);
}
if($type == 'slider-full'){
$columns = null;
}
// Add Animations
if($animate) {$animate = 'data-animate="'.$animate.'"';}
// Set box style
if($style) $classes_box[] = 'box-'.$style;
if($style == 'overlay') $classes_box[] = 'dark';
if($style == 'shade') $classes_box[] = 'dark';
if($style == 'badge') $classes_box[] = 'hover-dark';
if($text_pos) $classes_box[] = 'box-text-'.$text_pos;
if($style == 'overlay' && !$image_overlay) $image_overlay = 'rgba(0,0,0,.15)';
// Set image styles
if($image_hover) $classes_image[] = 'image-'.$image_hover;
if($image_hover_alt) $classes_image[] = 'image-'.$image_hover_alt;
if($depth) $classes_image[] = 'box-shadow-'.$depth;
if($depth_hover) $classes_image[] = 'box-shadow-'.$depth_hover.'-hover';
if($image_height) $classes_image[] = 'image-cover';
// Text classes
if($text_hover) $classes_text[] = 'show-on-hover hover-'.$text_hover;
if($text_align) $classes_text[] = 'text-'.$text_align;
if($text_size) $classes_text[] = 'is-'.$text_size;
if($text_color == 'dark') $classes_text[] = 'dark';
$css_args_img = array(
array( 'attribute' => 'border-radius', 'value' => $image_radius, 'unit' => '%'),
array( 'attribute' => 'width', 'value' => $image_width, 'unit' => '%' ),
array( 'attribute' => 'padding-top', 'value' => $image_height),
);
$css_args_text = array(
array( 'attribute' => 'background-color', 'value' => $text_bg ),
array( 'attribute' => 'padding', 'value' => $text_padding ),
);
if ( $is_multi_gallery = get_theme_mod( 'flatsome_lightbox_multi_gallery' ) ) {
$classes[] = 'lightbox-multi-gallery';
}
// Repeater options
$repeater['id'] = $_id;
$repeater['type'] = $type;
$repeater['style'] = $style;
$repeater['class'] = implode ( ' ', $classes );
$repeater['visibility'] = $visibility;
$repeater['slider_style'] = $slider_nav_style;
$repeater['slider_style'] = $slider_nav_style;
$repeater['slider_nav_position'] = $slider_nav_position;
$repeater['slider_bullets'] = $slider_bullets;
$repeater['slider_nav_color'] = $slider_nav_color;
$repeater['auto_slide'] = $auto_slide;
$repeater['infinitive'] = $infinitive;
$repeater['row_spacing'] = $col_spacing;
$repeater['row_width'] = $width;
$repeater['columns'] = $columns;
$repeater['columns__sm'] = $columns__sm;
$repeater['columns__md'] = $columns__md;
// Get attachments
$_attachments = get_posts( array( 'include' => $ids, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) );
$attachments = array();
foreach ( $_attachments as $key => $val ) {
$attachments[$val->ID] = $_attachments[$key];
}
if ( empty( $attachments ) ) {
ob_end_clean();
return '';
}
get_flatsome_repeater_start($repeater);
foreach ( $attachments as $id => $attachment ) {
$link_start = '';
$link_end = '';
$content = $attachment->post_content;
$classes_col = array('gallery-col','col');
// Add Video icon
$has_video = false;
if(isset($content) && strpos($content, 'watch?v=') !== false){
$has_video = true;
if(!$image_overlay) $image_overlay = 'rgba(0,0,0,.2)';
$link_start = '<a href="'.$content.'" class="open-video" title="'. esc_attr( $attachment->post_excerpt ) . '">';
$link_end = '</a>';
} else if( 'false' !== $lightbox) {
$get_image = wp_get_attachment_image_src( $attachment->ID, $lightbox_image_size);
$link_class = $is_multi_gallery ? '' : 'image-lightbox lightbox-gallery';
$link_start = '<a class="' . $link_class . '" href="'.$get_image[0].'" title="'. esc_attr( $attachment->post_excerpt ) . '">';
$link_end = '</a>';
}
if($type == 'grid'){
if($grid_total > $current_grid) $current_grid++;
$current = $current_grid-1;
$classes_col[] = 'grid-col';
if($grid[$current]['height']) $classes_col[] = 'grid-col-'.$grid[$current]['height'];
if($grid[$current]['span']) $classes_col[] = 'large-'.$grid[$current]['span'];
if($grid[$current]['md']) $classes_col[] = 'medium-'.$grid[$current]['md'];
// Set image size
if($grid[$current]['size'] == 'large') $image_size = 'large';
if($grid[$current]['size'] == 'medium') $image_size = 'medium';
}
$image_output = wp_get_attachment_image( $id, $image_size, false, $atts );
?><div class="<?php echo implode(' ', $classes_col); ?>" <?php echo $animate;?>>
<div class="col-inner">
<?php echo $link_start; ?>
<div class="<?php echo implode(' ', $classes_box); ?>">
<div class="<?php echo implode(' ', $classes_image); ?>" <?php echo get_shortcode_inline_css($css_args_img); ?>>
<?php echo $image_output; ?>
<?php if($image_overlay){ ?>
<div class="overlay fill"
style="background-color: <?php echo $image_overlay;?>">
</div>
<?php } ?>
<?php if($style == 'shade'){ ?>
<div class="shade"></div>
<?php } ?>
<?php if($has_video) { ?>
<div class="absolute no-click x50 y50 md-x50 md-y50 lg-x50 lg-y50 text-shadow-2">
<div class="overlay-icon">
<i class="icon-play"></i>
</div>
</div>
<?php } ?>
</div>
<div class="<?php echo implode(' ', $classes_text); ?>" <?php echo get_shortcode_inline_css($css_args_text); ?>>
<p><?php echo $attachment->post_excerpt; ?></p>
</div>
</div>
<?php echo $link_end; ?>
</div>
</div><?php
} // Loop
get_flatsome_repeater_end($repeater);
$content = ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode("ux_gallery", "ux_gallery");

View File

@@ -0,0 +1,89 @@
<?php
// [ux_hotspot]
function ux_hotspot( $atts, $content = null ) {
extract( shortcode_atts( array(
'class' => '',
'visibility' => '',
'type' => 'text',
'text' => 'Enter text here',
'link' => '#hotspot',
'bg_color' => '',
'position_x' => '50',
'position_x__sm' => '',
'position_x__md' => '',
'position_y' => '50',
'position_y__sm' => '',
'position_y__md' => '',
'size' => '',
'icon' => 'plus',
'depth' => '',
'depth_hover' => '',
'animate' => 'bounceIn',
'prod_id' => '149',
), $atts ) );
$classes = array( 'hotspot-wrapper' );
$classes_inner = array( 'hotspot tooltip' );
if ( $class ) {
$classes[] = $class;
}
if ( $visibility ) {
$classes[] = $visibility;
}
// Set positions.
$classes[] = flatsome_position_classes( 'x', $position_x, $position_x__sm, $position_x__md );
$classes[] = flatsome_position_classes( 'y', $position_y, $position_y__sm, $position_y__md );
// Size.
if ( $size ) {
$classes[] = 'is-' . $size;
}
$classes = implode( ' ', $classes );
if ( $depth ) {
$classes_inner[] = 'box-shadow-' . $depth;
}
if ( $depth_hover ) {
$classes_inner[] = 'box-shadow-' . $depth . '-hover';
}
$classes_inner = implode( ' ', $classes_inner );
$css_args = array(
'bg_color' => array(
'attribute' => 'background-color',
'value' => $bg_color,
),
);
// load quick view script for products.
if ( $type == 'product' && ! get_theme_mod( 'disable_quick_view' ) ) {
wp_enqueue_script( 'wc-add-to-cart-variation' );
}
?>
<div class="<?php echo $classes; ?> dark">
<div data-animate="<?php echo $animate; ?>">
<?php if ( $type == 'text' ) { ?>
<a href="<?php echo $link; ?>" class="<?php echo $classes_inner; ?>" title="<?php echo $text; ?>" <?php echo get_shortcode_inline_css( $css_args ); ?>>
<i class="icon-<?php echo $icon; ?>"></i>
</a>
<?php } else if ( $type == 'product' ) {
if ( get_theme_mod( 'disable_quick_view' ) ) : ?>
<a href="<?php echo esc_url( get_permalink( $prod_id ) ); ?>" class="<?php echo $classes_inner; ?>" title="<?php echo get_the_title( $prod_id ); ?>" <?php echo get_shortcode_inline_css( $css_args ); ?>>
<i class="icon-<?php echo $icon; ?>"></i>
</a>
<?php else : ?>
<a href="#quick-view" class="<?php echo $classes_inner; ?> quick-view" data-prod="<?php echo $prod_id; ?>" title="<?php echo get_the_title( $prod_id ); ?>" <?php echo get_shortcode_inline_css( $css_args ); ?>>
<i class="icon-<?php echo $icon; ?>"></i>
</a>
<?php endif; ?>
<?php } ?>
</div>
</div>
<?php
}
add_shortcode( 'ux_hotspot', 'ux_hotspot' );

View File

@@ -0,0 +1,45 @@
<?php
/**
* Registers the `ux_html` shortcode.
*
* @package flatsome
*/
/**
* Renders the `ux_html` shortcode.
*
* @param array $atts An array of attributes.
* @param string $content The shortcode content.
* @param string $tag The name of the shortcode, provided for context to enable filtering.
*
* @return string
*/
function flatsome_render_ux_html_shortcode( $atts, $content, $tag ) {
$atts = shortcode_atts(
array(
'visibility' => '',
'class' => '',
'label' => '',
),
$atts,
$tag
);
$classes = array();
if ( ! empty( $atts['class'] ) ) $classes[] = $atts['class'];
if ( ! empty( $atts['visibility'] ) ) $classes[] = $atts['visibility'];
if ( empty( $classes ) ) {
return do_shortcode( $content );
}
ob_start(); ?>
<div class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>">
<?php echo do_shortcode( $content ); ?>
</div>
<?php
return ob_get_clean();
}
add_shortcode( 'ux_html', 'flatsome_render_ux_html_shortcode' );

View File

@@ -0,0 +1,178 @@
<?php
function ux_image( $atts, $content = null ) {
extract( shortcode_atts( array(
'_id' => 'image_' . rand(),
'class' => '',
'visibility' => '',
'id' => '',
'org_img' => '',
'caption' => '',
'animate' => '',
'animate_delay' => '',
'lightbox' => '',
'lightbox_image_size' => 'large',
'lightbox_caption' => '',
'height' => '',
'image_overlay' => '',
'image_hover' => '',
'image_hover_alt' => '',
'image_size' => 'large',
'icon' => '',
'width' => '',
'margin' => '',
'position_x' => '',
'position_x__sm' => '',
'position_x__md' => '',
'position_y' => '',
'position_y__sm' => '',
'position_y__md' => '',
'depth' => '',
'parallax' => '',
'depth_hover' => '',
'link' => '',
'target' => '_self',
'rel' => '',
), $atts ) );
if ( empty( $id ) ) {
return '<div class="uxb-no-content uxb-image">Upload Image...</div>';
}
// Ensure key existence when builder setting is
// not touched, to extract responsive widths.
if ( ! array_key_exists( 'width', $atts ) ) {
$atts['width'] = '100';
}
$classes = array();
if ( $class ) $classes[] = $class;
if ( $visibility ) $classes[] = $visibility;
$classes_inner = array( 'img-inner' );
$classes_img = array();
$image_meta = wp_prepare_attachment_for_js( $id );
$link_atts = array(
'target' => $target,
'rel' => array( $rel ),
);
if ( is_numeric( $id ) ) {
if ( ! $org_img ) {
$org_img = wp_get_attachment_image_src( $id, $lightbox_image_size );
$org_img = $org_img ? $org_img[0] : '';
}
if ( $caption && $caption == 'true' ) {
$caption = is_array( $image_meta ) ? $image_meta['caption'] : '';
}
} else {
if ( ! $org_img ) {
$org_img = $id;
}
}
// If caption is enabled.
$link_start = '';
$link_end = '';
$link_class = '';
if ( $link ) {
if ( strpos( $link, 'watch?v=' ) !== false ) {
$icon = 'icon-play';
$link_class = 'open-video';
if ( ! $image_overlay ) {
$image_overlay = 'rgba(0,0,0,.2)';
}
}
$link_start = '<a class="' . $link_class . '" href="' . $link . '"' . flatsome_parse_target_rel( $link_atts ) . '>';
$link_end = '</a>';
} elseif ( $lightbox ) {
$title = $lightbox_caption ? $image_meta['caption'] : '';
$link_start = '<a class="image-lightbox lightbox-gallery" title="' . esc_attr( $title ) . '" href="' . $org_img . '">';
$link_end = '</a>';
}
// Set positions
if ( function_exists( 'ux_builder_is_active' ) && ux_builder_is_active() ) {
// Do not add positions if builder is active.
// They will be set by the onChange handler.
} else {
$classes[] = flatsome_position_classes( 'x', $position_x, $position_x__sm, $position_x__md );
$classes[] = flatsome_position_classes( 'y', $position_y, $position_y__sm, $position_y__md );
}
if ( $image_hover ) {
$classes_inner[] = 'image-' . $image_hover;
}
if ( $image_hover_alt ) {
$classes_inner[] = 'image-' . $image_hover_alt;
}
if ( $height ) {
$classes_inner[] = 'image-cover';
}
if ( $depth ) {
$classes_inner[] = 'box-shadow-' . $depth;
}
if ( $depth_hover ) {
$classes_inner[] = 'box-shadow-' . $depth_hover . '-hover';
}
// Add Parallax Attribute.
if ( $parallax ) {
$parallax = 'data-parallax-fade="true" data-parallax="' . $parallax . '"';
}
// Set image height.
$css_image_height = array(
array( 'attribute' => 'padding-top', 'value' => $height ),
array( 'attribute' => 'margin', 'value' => $margin ),
);
$classes = implode( " ", $classes );
$classes_inner = implode( " ", $classes_inner );
$classes_img = implode( " ", $classes_img );
ob_start();
?>
<div class="img has-hover <?php echo $classes; ?>" id="<?php echo $_id; ?>">
<?php echo $link_start; ?>
<?php if ( $parallax ) echo '<div ' . $parallax . '>'; ?>
<?php if ( $animate ) echo '<div data-animate="' . $animate . '">'; ?>
<div class="<?php echo $classes_inner; ?> dark" <?php echo get_shortcode_inline_css( $css_image_height ); ?>>
<?php echo flatsome_get_image( $id, $image_size, $caption ); ?>
<?php if ( $image_overlay ) { ?>
<div class="overlay" style="background-color: <?php echo $image_overlay; ?>"></div>
<?php } ?>
<?php if ( $icon ) { ?>
<div class="absolute no-click x50 y50 md-x50 md-y50 lg-x50 lg-y50 text-shadow-2">
<div class="overlay-icon">
<i class="icon-play"></i>
</div>
</div>
<?php } ?>
<?php if ( $caption ) { ?>
<div class="caption"><?php echo $caption; ?></div>
<?php } ?>
</div>
<?php if ( $animate ) echo '</div>'; ?>
<?php if ( $parallax ) echo '</div>'; ?>
<?php echo $link_end; ?>
<?php
$args = array(
'width' => array(
'selector' => '',
'property' => 'width',
'unit' => '%',
),
);
echo ux_builder_element_style_tag( $_id, $args, $atts );
?>
</div>
<?php
$content = ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode( 'ux_image', 'ux_image' );

View File

@@ -0,0 +1,113 @@
<?php
function ux_image_box( $atts, $content = null ) {
extract( shortcode_atts( array(
'_id' => null,
'class' => '',
'visibility' => '',
'img' => '',
'style' => '',
'depth' => '',
'depth_hover' => '',
'link' => '',
'target' => '_self',
'rel' => '',
// Box styles
'animate' => '',
'text_pos' => 'bottom',
'text_padding' => '',
'text_bg' => '',
'text_color' => '',
'text_hover' => '',
'text_align' => 'center',
'text_size' => '',
'image_size' => '',
'image_width' => '',
'image_height' => '',
'image_hover' => '',
'image_radius' => '',
'image_hover_alt' => '',
'image_overlay' => '',
), $atts ) );
ob_start();
// Set Classes.
$classes_box = array();
$classes_text = array();
$classes_image = array();
$classes_box[] = $class;
$classes_box[] = $visibility;
// Set box style.
$classes_box[] = 'has-hover';
if ( $depth ) $classes_box[] = 'box-shadow-' . $depth;
if ( $depth_hover ) $classes_box[] = 'box-shadow-' . $depth_hover . '-hover';
$link_atts = array(
'target' => $target,
'rel' => array( $rel ),
);
$link_start = '<a href="' . $link . '"' . flatsome_parse_target_rel( $link_atts ) . '>';
$link_end = '</a>';
if ( $style ) $classes_box[] = 'box-' . $style;
if ( $style == 'overlay' ) $classes_box[] = 'dark';
if ( $style == 'shade' ) $classes_box[] = 'dark';
if ( $style == 'badge' ) $classes_box[] = 'hover-dark';
if ( $text_pos ) $classes_box[] = 'box-text-' . $text_pos;
if ( $style == 'overlay' && ! $image_overlay ) $image_overlay = true;
if ( $image_hover ) $classes_image[] = 'image-' . $image_hover;
if ( $image_hover_alt ) $classes_image[] = 'image-' . $image_hover_alt;
if ( $image_height ) $classes_image[] = 'image-cover';
// Text classes
if ( $text_hover ) $classes_text[] = 'show-on-hover hover-' . $text_hover;
if ( $text_align ) $classes_text[] = 'text-' . $text_align;
if ( $text_size ) $classes_text[] = 'is-' . $text_size;
if ( $text_color == 'dark' ) $classes_text[] = 'dark';
if ( $animate ) $animate = 'data-animate="' . $animate . '"';
$css_args = array(
array( 'attribute' => 'background-color', 'value' => $text_bg ),
array( 'attribute' => 'padding', 'value' => $text_padding ),
);
$css_image = array(
array( 'attribute' => 'border-radius', 'value' => $image_radius, 'unit' => '%' ),
array( 'attribute' => 'width', 'value' => $image_width, 'unit' => '%' ),
);
$css_image_height = array(
array( 'attribute' => 'padding-top', 'value' => $image_height ),
);
?>
<div class="box has-hover <?php echo implode( ' ', $classes_box ); ?>" <?php echo $animate; ?>>
<div class="box-image" <?php echo get_shortcode_inline_css( $css_image ); ?>>
<?php if ( $link ) echo $link_start; ?>
<div class="<?php echo implode( ' ', $classes_image ); ?>" <?php echo get_shortcode_inline_css( $css_image_height ); ?>>
<?php echo flatsome_get_image( $img, $image_size ); ?>
<?php if ( $image_overlay ) { ?><div class="overlay" style="background-color:<?php echo $image_overlay; ?>"></div><?php } ?>
<?php if ( $style == 'shade' ) { ?><div class="shade"></div><?php } ?>
</div>
<?php if ( $link ) echo $link_end; ?>
</div>
<div class="box-text <?php echo implode( ' ', $classes_text ); ?>" <?php echo get_shortcode_inline_css( $css_args ); ?>>
<div class="box-text-inner">
<?php echo do_shortcode( $content ); ?>
</div>
</div>
</div>
<?php
$content = ob_get_contents();
ob_end_clean();
return $content;
};
add_shortcode( 'ux_image_box', 'ux_image_box' );

View File

@@ -0,0 +1,439 @@
<?php
// Instagram Feed
function ux_instagram_feed( $atts, $content = null ) {
extract( shortcode_atts( array(
'_id' => 'instagram-' . rand(),
'photos' => '10',
'class' => '',
'visibility' => '',
'username' => 'wonderful_places',
'hashtag' => '',
'hashtag_media' => 'top', // or recent
'target' => '_self',
'caption' => 'true',
'link' => '',
// Layout.
'columns' => '5',
'columns__sm' => '',
'columns__md' => '',
'type' => 'row',
'col_spacing' => 'collapse',
'slider_style' => '',
'slider_nav_color' => '',
'slider_nav_style' => '',
'slider_nav_position' => '',
'slider_bullets' => 'false',
'width' => '',
'depth' => '',
'depth_hover' => '',
'animate' => '',
'auto_slide' => '',
'infinitive' => 'true',
// Image.
'lightbox' => '',
'image_overlay' => '',
'image_hover' => 'overlay-remove',
'size' => 'small', // small - thumbnail - original.
), $atts ) );
ob_start();
$limit = $photos;
if ( $username != '' ) {
if ( substr( $username, 0, 1 ) === '#' ) {
$hashtag = substr( $username, 1 );
}
$media_array = flatsome_instagram_get_feed( $username, $hashtag, $hashtag_media );
if ( empty( $media_array ) ) {
echo esc_html__( 'No images found.', 'flatsome-admin' );
} elseif ( is_wp_error( $media_array ) ) {
echo wp_kses_post( $media_array->get_error_message() );
} else {
// Slice list down to required limit.
$media_array = array_slice( $media_array, 0, $limit );
$repeater['id'] = $_id;
$repeater['type'] = $type;
$repeater['class'] = $class;
$repeater['visibility'] = $visibility;
$repeater['style'] = 'overlay';
$repeater['slider_style'] = $slider_nav_style;
$repeater['slider_nav_position'] = $slider_nav_position;
$repeater['slider_nav_color'] = $slider_nav_color;
$repeater['slider_bullets'] = $slider_bullets;
$repeater['auto_slide'] = $auto_slide;
$repeater['infinitive'] = $infinitive;
$repeater['row_spacing'] = $col_spacing;
$repeater['row_width'] = $width;
$repeater['columns'] = $columns;
$repeater['columns__sm'] = $columns__sm;
$repeater['columns__md'] = $columns__md;
$repeater['depth'] = $depth;
$repeater['depth_hover'] = $depth_hover;
// Filters for custom classes.
get_flatsome_repeater_start( $repeater );
foreach ( $media_array as $item ) {
echo '<div class="col"><div class="col-inner">';
$image_url = $item['media_url']
? set_url_scheme( $item['media_url'] )
: '';
if ( $caption ) {
$caption = $item['description'];
}
?><div class="img has-hover no-overflow">
<div class="dark instagram-image-container image-<?php echo $image_hover; ?> instagram-image-type--<?php echo $item['type']; ?>">
<a href="<?php echo $item['link']; ?>" target="_blank" rel="noopener noreferrer" class="plain">
<?php echo flatsome_get_image( $image_url, false, $caption ); ?>
<?php if ( $image_overlay ) { ?>
<div class="overlay" style="background-color: <?php echo $image_overlay; ?>"></div>
<?php } ?>
<?php if ( $caption ) { ?>
<div class="caption"><?php echo $caption; ?></div>
<?php } ?>
</a>
</div>
</div><?php
echo '</div></div>';
}
get_flatsome_repeater_end( $repeater );
}
}
if ( $link != '' ) {
?>
<a class="plain uppercase" href="<?php echo trailingslashit( '//instagram.com/' . esc_attr( trim( $username ) ) ); ?>" rel="me"
target="<?php echo esc_attr( $target ); ?>"><?php echo get_flatsome_icon( 'icon-instagram' ); ?><?php echo wp_kses_post( $link ); ?></a>
<?php
}
$w = ob_get_contents();
ob_end_clean();
return $w;
}
add_shortcode( 'ux_instagram_feed', 'ux_instagram_feed' );
function flatsome_instagram_get_feed( $username, $hashtag, $hashtag_media ) {
$theme = wp_get_theme( get_template() );
$accounts = flatsome_facebook_accounts();
$username = strtolower( $username );
$username = str_replace( '@', '', $username );
$account = array_key_exists( $username, $accounts ) ? $accounts[ $username ] : false;
$transient_name = 'flatsome_instagram';
$transient_name .= '_' . str_replace( '-', '_', sanitize_title_with_dashes( $username ) );
if ( $hashtag ) {
$transient_name .= '_' . str_replace( '-', '_', sanitize_title_with_dashes( $hashtag ) );
$transient_name .= '_' . $hashtag_media;
}
$transient_name .= '_' . ( $account ? 'account' : 'scrape' );
$transient_name .= '_' . str_replace( array( '.', '-' ), '_', $theme['Version'] );
$instagram = get_transient( $transient_name );
if ( ! empty( $instagram ) ) {
return unserialize( base64_decode( $instagram ) );
}
if ( $account ) {
$instagram = flatsome_instagram_account_feed( $username, $account, $hashtag, $hashtag_media );
} else {
$instagram = flatsome_instagram_scrape_html( $username, $hashtag );
}
if ( is_wp_error( $instagram ) ) {
return $instagram;
}
$instagram_cache = base64_encode( serialize( $instagram ) ); // 100% safe - ignore theme check nag
set_transient( $transient_name, $instagram_cache, apply_filters( 'null_instagram_cache_time', HOUR_IN_SECONDS * 2 ) );
return $instagram;
}
function flatsome_instagram_account_feed( $username, $account, $hashtag = '', $hashtag_media = 'top' ) {
$access_token = array_key_exists( 'user_access_token', $account )
? $account['user_access_token'] // For accounts connected prior to 31.08.20.
: $account['access_token'];
$id = $account['id'];
$results = array();
$instagram = array();
if ( $hashtag ) {
$results = flatsome_instagram_get_hashtag_media( $hashtag, $hashtag_media, $id, $access_token );
} else {
$results = flatsome_instagram_get_media( $id, $access_token );
}
if ( is_wp_error( $results ) ) {
return $results;
} else if ( ! $results || empty( $results['data'] ) ) {
return $instagram;
}
foreach ( $results['data'] as $item ) {
$media_type = $item['media_type'];
$permalink = $item['permalink'];
$caption = ! empty( $item['caption'] )
? wp_kses( $item['caption'], array() )
: __( 'Instagram Image', 'flatsome-admin' );
$timestamp = array_key_exists( 'timestamp', $item )
? $item['timestamp']
: null;
$media_url = array_key_exists( 'media_url', $item )
? $item['media_url']
: null;
if ( $media_type === 'CAROUSEL_ALBUM' && ! empty( $item['children']['data'] ) ) {
$carousel_item = $item['children']['data'][0];
$media_type = $carousel_item['media_type'];
if ( array_key_exists( 'media_url', $carousel_item ) ) {
$media_url = $carousel_item['media_url'];
}
}
if ( $media_type === 'VIDEO' || empty( $media_url ) ) {
$response = flatsome_instagram_get_oembed_thumbnail( $permalink, $access_token );
if ( is_wp_error( $response ) ) {
$media_url = '';
} elseif ( isset( $response['thumbnail_url'] ) ) {
$media_url = $response['thumbnail_url'];
}
}
$instagram[] = array(
'type' => strtolower( $media_type ),
'description' => $caption,
'link' => $permalink,
'time' => $timestamp,
'comments' => $item['comments_count'],
'likes' => $item['like_count'],
'media_url' => $media_url,
);
}
return $instagram;
}
function flatsome_instagram_get_oembed_cache( $permalink ) {
$cache = get_option( 'flatsome_instagram_oembed_cache', array() );
$parts = explode( '/', $permalink );
$parts = array_filter( $parts );
$id = array_pop( $parts );
if ( ! is_array( $cache ) ) $cache = array();
if ( array_key_exists( $id, $cache ) ) {
if ( isset( $cache[ $id ]['error'] ) ) {
return $cache[ $id ]['cached_at'] + 300 > time()
? new WP_Error( 'site_down', $cache[ $id ]['error'] )
: false;
} elseif ( $cache[ $id ]['cached_at'] + DAY_IN_SECONDS > time() ) {
return $cache[ $id ];
}
}
return false;
}
function flatsome_instagram_set_oembed_cache( $permalink, $data ) {
$cache = get_option( 'flatsome_instagram_oembed_cache', array() );
$parts = explode( '/', $permalink );
$parts = array_filter( $parts );
$id = array_pop( $parts );
if ( ! is_array( $cache ) ) $cache = array();
if ( array_key_exists( $id, $cache ) ) {
unset( $cache[ $id ] );
}
$data['cached_at'] = time();
$cache = array_merge( array( $id => $data ), $cache );
$cache = array_slice( $cache, 0, 500 );
update_option( 'flatsome_instagram_oembed_cache', $cache, false );
}
function flatsome_instagram_get_oembed_thumbnail( $permalink, $access_token ) {
$cache = flatsome_instagram_get_oembed_cache( $permalink );
if ( $cache ) return $cache;
$version = flatsome_facebook_api_version();
$fields = 'thumbnail_url';
$url = "https://graph.facebook.com/$version/instagram_oembed?url=$permalink&fields=$fields&access_token=$access_token";
$response = wp_remote_get( $url );
if ( is_wp_error( $response ) ) {
return new WP_Error( 'site_down', __( 'Unable to communicate with Instagram.', 'flatsome-admin' ) );
} else {
$body = json_decode( $response['body'], true );
if ( array_key_exists( 'error', $body ) ) {
flatsome_instagram_set_oembed_cache( $permalink, array(
'error' => $body['error']['message'],
) );
return new WP_Error( 'site_down', $body['error']['message'] );
}
flatsome_instagram_set_oembed_cache( $permalink, $body );
return $body;
}
}
function flatsome_instagram_get_media( $id, $access_token ) {
$version = flatsome_facebook_api_version();
$fields = 'timestamp,caption,media_type,media_url,thumbnail_url,like_count,comments_count,permalink';
$url = "https://graph.facebook.com/$version/$id/media?fields=$fields&access_token=$access_token";
$response = wp_remote_get( $url );
if ( is_wp_error( $response ) ) {
return new WP_Error( 'site_down', __( 'Unable to communicate with Instagram.', 'flatsome-admin' ) );
} else {
$body = json_decode( $response['body'], true );
if ( array_key_exists( 'error', $body ) ) {
return new WP_Error( 'site_down', $body['error']['message'] );
}
return $body;
}
}
function flatsome_instagram_get_hashtag_id( $hashtag, $user_id, $access_token ) {
if ( substr( $hashtag, 0, 1 ) === '#' ) {
$hashtag = substr( $hashtag, 1 );
}
$version = flatsome_facebook_api_version();
$url = "https://graph.facebook.com/$version/ig_hashtag_search?user_id=$user_id&q=$hashtag&access_token=$access_token";
$response = wp_remote_get( $url );
if ( is_wp_error( $response ) ) {
return new WP_Error( 'site_down', __( 'Unable to communicate with Instagram.', 'flatsome-admin' ) );
} else {
$body = json_decode( $response['body'], true );
if ( array_key_exists( 'error', $body ) ) {
return new WP_Error( 'site_down', $body['error']['message'] );
}
return $body ;
}
}
function flatsome_instagram_get_hashtag_media( $name, $type, $user_id, $access_token ) {
$hashtag = flatsome_instagram_get_hashtag_id( $name, $user_id, $access_token );
if ( is_wp_error( $hashtag ) ) {
return $hashtag;
}
$tag_id = $hashtag['data'][ 0 ]['id'];
$version = flatsome_facebook_api_version();
$endpoint = $type === 'recent' ? 'recent_media' : 'top_media';
$fields = 'caption,media_type,media_url,like_count,comments_count,permalink';
$url = "https://graph.facebook.com/$version/$tag_id/$endpoint?user_id=$user_id&fields=$fields&access_token=$access_token";
$response = wp_remote_get( $url );
if ( is_wp_error( $response ) ) {
return new WP_Error( 'site_down', __( 'Unable to communicate with Instagram.', 'flatsome-admin' ) );
} else {
$body = json_decode( $response['body'], true );
if ( array_key_exists( 'error', $body ) ) {
return new WP_Error( 'site_down', $body['error']['message'] );
}
return $body;
}
}
function flatsome_instagram_scrape_html( $username, $hashtag ) {
$req_param = ( $hashtag ) ? 'explore/tags/' . $hashtag : trim( $username );
$remote = wp_remote_get( 'https://instagram.com/' . $req_param );
$instagram = array();
if ( is_wp_error( $remote ) ) {
return new WP_Error( 'site_down', esc_html__( 'Unable to communicate with Instagram.', 'flatsome-admin' ) );
}
if ( 200 != wp_remote_retrieve_response_code( $remote ) ) {
return new WP_Error( 'invalid_response', esc_html__( 'Instagram did not return a 200.', 'flatsome-admin' ) );
}
$shards = explode( 'window._sharedData = ', $remote['body'] );
$insta_json = explode( ';</script>', $shards[1] );
$insta_array = json_decode( $insta_json[0], true );
if ( ! $insta_array ) {
return new WP_Error( 'bad_json', esc_html__( 'Instagram has returned invalid data.', 'flatsome-admin' ) );
}
if ( isset( $insta_array['entry_data']['ProfilePage'][0]['graphql']['user']['edge_owner_to_timeline_media']['edges'] ) ) {
$edges = $insta_array['entry_data']['ProfilePage'][0]['graphql']['user']['edge_owner_to_timeline_media']['edges'];
} elseif ( $hashtag && isset( $insta_array['entry_data']['TagPage'][0]['graphql']['hashtag']['edge_hashtag_to_media']['edges'] ) ) {
$edges = $insta_array['entry_data']['TagPage'][0]['graphql']['hashtag']['edge_hashtag_to_media']['edges'];
} else {
return new WP_Error( 'bad_json_2', esc_html__( 'Instagram has returned invalid data.', 'flatsome-admin' ) );
}
if ( ! is_array( $edges ) ) {
return new WP_Error( 'bad_array', esc_html__( 'Instagram has returned invalid data.', 'flatsome-admin' ) );
}
foreach ( $edges as $edge ) {
$edge['node']['thumbnail_src'] = preg_replace( '/^https?\:/i', '', $edge['node']['thumbnail_src'] );
$edge['node']['display_url'] = preg_replace( '/^https?\:/i', '', $edge['node']['display_url'] );
if ( isset( $edge['node']['thumbnail_resources'] ) && is_array( $edge['node']['thumbnail_resources'] ) ) {
$edge['node']['thumbnail'] = $edge['node']['thumbnail_resources'][0]['src']; // 150x150
$edge['node']['small'] = $edge['node']['thumbnail_resources'][2]['src']; // 320x320
} else {
$edge['node']['thumbnail'] = $edge['node']['small'] = $edge['node']['thumbnail_src'];
}
$edge['node']['large'] = $edge['node']['thumbnail_src'];
if ( $edge['node']['is_video'] == true ) {
$type = 'video';
} else {
$type = 'image';
}
$caption = __( 'Instagram Image', 'flatsome-admin' );
if ( ! empty( $edge['node']['edge_media_to_caption']['edges'][0]['node']['text'] ) ) {
$caption = wp_kses( $edge['node']['edge_media_to_caption']['edges'][0]['node']['text'], array() );
}
$instagram[] = array(
'type' => $type,
'description' => $caption,
'link' => trailingslashit( '//instagram.com/p/' . $edge['node']['shortcode'] ),
'time' => $edge['node']['taken_at_timestamp'],
'comments' => $edge['node']['edge_media_to_comment']['count'],
'likes' => $edge['node']['edge_liked_by']['count'],
'media_url' => $edge['node']['display_url'],
);
}
return $instagram;
}

View File

@@ -0,0 +1,61 @@
<?php
// [logo img=""]
function ux_logo( $atts, $content = null ){
extract( shortcode_atts( array(
'class' => '',
'visibility' => '',
'img' => '',
'image_size' => 'original',
'padding' => '15px',
'title' => '',
'hover' => '',
'link' => '',
'target' => '_self',
'rel' => '',
'height' => '50',
), $atts ) );
$classes = array('ux-logo', 'has-hover', 'align-middle', 'ux_logo', 'inline-block');
$org_img = '';
if ( $class ) $classes[] = $class;
if ( $visibility ) $classes[] = $visibility;
$height = intval( $height );
$width = 'auto';
$link_atts = array(
'target' => $target,
'rel' => array( $rel ),
);
if(!$img){
$org_img = get_template_directory_uri().'/assets/img/logo.png';
$width = ($height / 84) * 400 + (intval($padding)*2).'px';
}
if ( $img && ! is_numeric( $img ) ) {
$org_img = $img;
} elseif ( $img ) {
$img_src = wp_get_attachment_image_src( $img, $image_size );
if ( $img_src ) {
$org_img = $img_src[0];
$org_height = $img_src[2];
// Check if width and height is set, because svg images has no size.
if ( $img_src[1] > 0 && $img_src[2] > 0 ) {
$width = $img_src[1];
$width = ( intval( $height ) / intval( $org_height ) ) * intval( $width ) + ( intval( $padding ) * 2 ) . 'px';
} else {
$width = 'auto';
}
}
}
// Set inner tag
$inner_tag = $link ? 'a' : 'div';
$content = '<div class="'.implode(' ', $classes).'" style="max-width: 100%!important; width: '.$width.'!important"><'.$inner_tag.' class="ux-logo-link block image-'.$hover.'" title="'.$title.'"' . flatsome_parse_target_rel( $link_atts ) . 'href="'.$link.'" style="padding: '.$padding.';"><img src="'.$org_img.'" title="'.$title.'" alt="'.$title.'" class="ux-logo-image block" style="height:'.$height.'px;" /></'.$inner_tag.'></div>';
return $content;
}
add_shortcode('logo', 'ux_logo');

View File

@@ -0,0 +1,46 @@
<?php
/**
* Registers the `ux_menu` shortcode.
*
* @package flatsome
*/
/**
* Renders the `ux_menu` shortcode.
*
* @param array $atts An array of attributes.
* @param string $content The shortcode content.
* @param string $tag The name of the shortcode, provided for context to enable filtering.
*
* @return string
*/
function flatsome_render_ux_menu_shortcode( $atts, $content, $tag ) {
$atts = shortcode_atts(
array(
'visibility' => '',
'class' => '',
'divider' => '',
),
$atts,
$tag
);
$classes = array( 'ux-menu', 'stack', 'stack-col', 'justify-start' );
if ( ! empty( $atts['class'] ) ) $classes[] = $atts['class'];
if ( ! empty( $atts['divider'] ) ) $classes[] = 'ux-menu--divider-' . $atts['divider'];
if ( ! empty( $atts['visibility'] ) ) $classes[] = $atts['visibility'];
wp_enqueue_script( 'css-vars-polyfill' );
ob_start();
?>
<div class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>">
<?php echo do_shortcode( $content ); ?>
</div>
<?php
return ob_get_clean();
}
add_shortcode( 'ux_menu', 'flatsome_render_ux_menu_shortcode' );

View File

@@ -0,0 +1,105 @@
<?php
/**
* Registers the `ux_menu_link` shortcode.
*
* @package flatsome
*/
/**
* Renders the `ux_menu_link` shortcode.
*
* @param array $atts An array of attributes.
* @param string $content The shortcode content.
* @param string $tag The name of the shortcode, provided for context to enable filtering.
*
* @return string
*/
function flatsome_render_ux_menu_link_shortcode( $atts, $content, $tag ) {
global $wp_query;
$atts = shortcode_atts(
array(
'visibility' => '',
'class' => '',
'text' => '',
'label' => '',
'icon' => '',
'post' => '',
'term' => '',
'link' => '',
'target' => '_self',
'rel' => '',
),
$atts,
$tag
);
$object = null;
$object_id = null;
$object_type = null;
$queried_object = $wp_query->get_queried_object();
$queried_object_id = (int) $wp_query->queried_object_id;
$classes = array( 'ux-menu-link flex menu-item' );
$link = trim( $atts['link'] );
$icon = $atts['icon'] ? get_flatsome_icon( 'ux-menu-link__icon text-center ' . $atts['icon'] ) : '';
if ( ! empty( $atts['post'] ) ) {
$object_type = 'post_type';
$object_id = (int) $atts['post'];
$object = get_post( $object_id );
$link = get_permalink( $object_id );
} elseif ( ! empty( $atts['term'] ) ) {
$object_type = 'taxonomy';
$object_id = (int) $atts['term'];
$object = get_term_by( 'term_taxonomy_id', $object_id );
$link = get_term_link( $object_id );
}
if ( ! is_string( $link ) ) {
$link = '';
}
// Ensure paths (except hash) are rendered as full URLs.
if ( substr( $link, 0, 1 ) !== '#' && ! wp_http_validate_url( $link ) ) {
$link = site_url( $link );
}
if ( ! empty( $atts['class'] ) ) $classes[] = $atts['class'];
if ( ! empty( $atts['label'] ) ) $classes[] = $atts['label'];
if ( ! empty( $atts['visibility'] ) ) $classes[] = $atts['visibility'];
if (
$object &&
$queried_object &&
$queried_object_id === $object_id &&
(
( $object_type === 'post_type' && $wp_query->is_singular ) ||
( $object_type === 'taxonomy' && $queried_object->taxonomy === $object->taxonomy )
)
) {
$classes[] = 'ux-menu-link--active';
}
$link_rels = explode( ' ', $atts['rel'] );
$link_atts = array(
'target' => $atts['target'],
'rel' => array_filter( $link_rels ),
);
ob_start();
?>
<div class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>">
<a class="ux-menu-link__link flex" href="<?php echo esc_attr( $link ); ?>"<?php echo flatsome_parse_target_rel( $link_atts ); ?>>
<?php echo $icon; ?>
<span class="ux-menu-link__text">
<?php echo esc_html( $atts['text'] ); ?>
</span>
</a>
</div>
<?php
return ob_get_clean();
}
add_shortcode( 'ux_menu_link', 'flatsome_render_ux_menu_link_shortcode' );

View File

@@ -0,0 +1,43 @@
<?php
/**
* Registers the `ux_menu_title` shortcode.
*
* @package flatsome
*/
/**
* Renders the `ux_menu_title` shortcode.
*
* @param array $atts An array of attributes.
* @param string $content The shortcode content.
* @param string $tag The name of the shortcode, provided for context to enable filtering.
*
* @return string
*/
function flatsome_render_ux_menu_title_shortcode( $atts, $content, $tag ) {
$atts = shortcode_atts(
array(
'visibility' => '',
'class' => '',
'text' => '',
),
$atts,
$tag
);
$classes = array( 'ux-menu-title', 'flex' );
if ( ! empty( $atts['class'] ) ) $classes[] = $atts['class'];
if ( ! empty( $atts['visibility'] ) ) $classes[] = $atts['visibility'];
ob_start();
?>
<div class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>">
<?php echo esc_html( $atts['text'] ); ?>
</div>
<?php
return ob_get_clean();
}
add_shortcode( 'ux_menu_title', 'flatsome_render_ux_menu_title_shortcode' );

View File

@@ -0,0 +1,62 @@
<?php
function ux_navigation($atts) {
extract(shortcode_atts(array(
'class' => '',
'visibility' => '',
'parent' => '',
'align' => 'left',
'style' => 'line',
'type' => 'vertical', // horizontal / vertical
'size' => '',
'case' => 'uppercase',
//'bg_color' => '',
//'height' => '',
//'sticky' => '',
), $atts));
ob_start();
global $post;
$current = get_the_ID($post->ID);
$classes = array('nav');
if($class) $classes[] = $class;
if($visibility) $classes[] = $visibility;
if($case) $classes[] = 'nav-'.$case;
if($type) $classes[] = 'nav-'.$type;
if($size) $classes[] = 'nav-size-'.$size;
if($style) $classes[] = 'nav-'.$style;
if($align) $classes[] = 'text-'.$align.' nav-'.$align;
echo '<div class="nav-wrapper">';
echo '<ul class="'.implode(' ',$classes).'">';
if ( is_page() && $post->post_parent && !$parent ){
$childpages = get_pages( array( 'child_of' => $post->post_parent, 'sort_column' => 'menu_order' ) );
} else {
$post_id = $post->ID;
if($parent) {
if(!is_numeric($parent)){
$id = get_page_by_path( $parent );
$parent = $id->ID;
}
$post_id = $parent;
}
$childpages = get_pages( array( 'child_of' => $post_id, 'sort_column' => 'menu_order' ) );
if(!$childpages) echo '<p class="lead shortcode-error text-center">Sorry, no pages was found</p>';
}
foreach ( $childpages as $page ) {
$classes = '';
if($page->ID == $current) $classes = 'active';
echo '<li class='.$classes.'><a href="'.get_the_permalink($page->ID).'">'.$page->post_title.'</a></li>';
}
echo '</ul>';
echo '</div>';
$content = ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode("ux_nav", "ux_navigation");

View File

@@ -0,0 +1,203 @@
<?php
function ux_pages($atts) {
extract(shortcode_atts(array(
// meta
'_id' => 'pages-'.rand(),
'class' => '',
'visibility' => '',
'parent' => '',
'orderby' => 'menu_order',
'order' => 'asc',
'ids' => false,
'target' => '',
// Layout
'style' => '',
'columns' => '4',
'columns__md' => '',
'columns__sm' => '',
'col_spacing' => '',
'type' => 'row', // slider, row, masonery, grid
'width' => '',
'grid' => '1',
'grid_height' => '600px',
'grid_height__md' => '500px',
'grid_height__sm' => '400px',
'slider_nav_style' => 'reveal',
'slider_nav_position' => '',
'slider_nav_color' => '',
'slider_bullets' => 'false',
'slider_arrows' => 'true',
'auto_slide' => 'false',
'infinitive' => 'true',
'depth' => '',
'depth_hover' => '',
// Box styles
'animate' => '',
'text_pos' => '',
'text_padding' => '',
'text_bg' => '',
'text_color' => '',
'text_hover' => '',
'text_align' => 'left',
'text_size' => '',
'image_size' => 'medium',
'image_mask' => '',
'image_width' => '',
'image_height' => '',
'image_radius' => '',
'image_hover' => '',
'image_hover_alt' => '',
'image_overlay' => '',
), $atts));
ob_start();
global $post;
if ( !empty( $ids ) ) {
$ids = explode( ',', $ids );
$ids = array_map( 'trim', $ids );
$childpages = get_pages( array( 'include' => $ids, 'sort_column' => $orderby , 'sort_order' => $order ) );
} else if ( is_page() && $post->post_parent && !$parent ){
$childpages = get_pages( array( 'child_of' => $post->post_parent, 'sort_column' => $orderby, 'sort_order' => $order ) );
} else {
$post_id = $post->ID;
if($parent) {
if(!is_numeric($parent)){
$id = get_page_by_path( $parent );
$parent = $id->ID;
}
$post_id = $parent;
}
$childpages = get_pages( array( 'child_of' => $post_id, 'sort_column' => $orderby, 'sort_order' => $order ) );
if(!$childpages) echo '<p class="lead shortcode-error text-center">Sorry, no pages was found</p>';
}
$classes_box = array('page-box','box','has-hover');
$classes_image = array('box-image');
$classes_text = array('box-text');
// Create Grid
if($type == 'grid'){
if(!$text_pos) $text_pos = 'center';
if(!$text_color) $text_color = 'dark';
if($style !== 'shade') $style = 'overlay';
$columns = 0;
$current_grid = 0;
$grid = flatsome_get_grid($grid);
$grid_total = count($grid);
flatsome_get_grid_height($grid_height, $_id);
}
// Add Animations
if($animate) {$animate = 'data-animate="'.$animate.'"';}
// Set box style
if($style) $classes_box[] = 'box-'.$style;
if($style == 'overlay') $classes_box[] = 'dark';
if($style == 'shade') $classes_box[] = 'dark';
if($style == 'badge') $classes_box[] = 'hover-dark';
if($text_pos) $classes_box[] = 'box-text-'.$text_pos;
if($style == 'overlay' && !$image_overlay) $image_overlay = 'rgba(0,0,0,.3)';
// Set image styles
if($image_hover) $classes_image[] = 'image-'.$image_hover;
if($image_hover_alt) $classes_image[] = 'image-'.$image_hover_alt;
if($image_height) $classes_image[] = 'image-cover';
// Text classes
if($text_hover) $classes_text[] = 'show-on-hover hover-'.$text_hover;
if($text_align) $classes_text[] = 'text-'.$text_align;
if($text_size) $classes_text[] = 'is-'.$text_size;
if($text_color == 'dark') $classes_text[] = 'dark';
$css_col = array(
array( 'attribute' => 'border-radius', 'value' => $image_radius, 'unit' => '%'),
);
$css_args_img = array(
array( 'attribute' => 'border-radius', 'value' => $image_radius, 'unit' => '%'),
array( 'attribute' => 'width', 'value' => $image_width, 'unit' => '%' ),
);
$css_args = array(
array( 'attribute' => 'background-color', 'value' => $text_bg ),
array( 'attribute' => 'padding', 'value' => $text_padding ),
);
$css_image_height = array(
array( 'attribute' => 'padding-top', 'value' => $image_height),
);
// Repeater options
$repeater['id'] = $_id;
$repeater['type'] = $type;
$repeater['style'] = $style;
$repeater['class'] = $class;
$repeater['visibility'] = $visibility;
$repeater['slider_style'] = $slider_nav_style;
$repeater['slider_nav_color'] = $slider_nav_color;
$repeater['slider_nav_position'] = $slider_nav_position;
$repeater['slider_bullets'] = $slider_bullets;
$repeater['auto_slide'] = $auto_slide;
$repeater['infinitive'] = $infinitive;
$repeater['row_spacing'] = $col_spacing;
$repeater['row_width'] = $width;
$repeater['columns'] = $columns;
$repeater['columns__md'] = $columns__md;
$repeater['columns__sm'] = $columns__sm;
$repeater['depth'] = $depth;
$repeater['depth_hover'] = $depth_hover;
get_flatsome_repeater_start($repeater);
foreach ( $childpages as $page ) {
$classes_col = array('page-col','col');
if($type == 'grid'){
if($grid_total > $current_grid) $current_grid++;
$current = $current_grid-1;
$classes_col[] = 'grid-col';
if($grid[$current]['height']) $classes_col[] = 'grid-col-'.$grid[$current]['height'];
if($grid[$current]['span']) $classes_col[] = 'large-'.$grid[$current]['span'];
if($grid[$current]['md']) $classes_col[] = 'medium-'.$grid[$current]['md'];
// Set image size
if($grid[$current]['size'] == 'large') $image_size = 'large';
if($grid[$current]['size'] == 'medium') $image_size = 'medium';
}
?><div class="<?php echo implode(' ', $classes_col); ?>" <?php echo $animate;?>>
<div class="col-inner" <?php echo get_shortcode_inline_css($css_col); ?>>
<a class="plain" href="<?php echo get_the_permalink($page->ID); ?>" title="<?php echo $page->post_title; ?>" target="<?php echo $target; ?>">
<div class="<?php echo implode(' ', $classes_box); ?>">
<div class="box-image" <?php echo get_shortcode_inline_css($css_args_img); ?>>
<div class="<?php echo implode(' ', $classes_image); ?>" <?php echo get_shortcode_inline_css($css_image_height); ?>>
<?php $img_id = get_post_thumbnail_id($page->ID); echo wp_get_attachment_image($img_id, $image_size); ?>
</div>
<?php if($image_overlay){ ?><div class="overlay" style="background-color: <?php echo $image_overlay;?>"></div><?php } ?>
<?php if($style == 'shade'){ ?><div class="shade"></div><?php } ?>
</div>
<div class="<?php echo implode(' ', $classes_text); ?>" <?php echo get_shortcode_inline_css($css_args); ?>>
<div class="box-text-inner">
<p><?php echo $page->post_title; ?></p>
</div>
</div>
</div>
</a>
</div>
</div><?php
} // Loop
echo '</div>';
$content = ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode("ux_pages", "ux_pages");

View File

@@ -0,0 +1,59 @@
<?php
function ux_payment_icons( $atts ) {
extract( shortcode_atts( array(
'link' => '',
'target' => '',
'rel' => '',
'icons' => get_theme_mod( 'payment_icons', array( 'visa', 'paypal', 'stripe', 'mastercard', 'cashondelivery' ) ),
'custom' => get_theme_mod( 'payment_icons_custom' ),
'class' => '',
'visibility' => '',
), $atts ) );
$classes = array( 'payment-icons', 'inline-block' );
if ( $class ) $classes[] = $class;
if ( $visibility ) $classes[] = $visibility;
$classes = implode( ' ', $classes );
$link_atts = array(
'target' => $target,
'rel' => array( $rel ),
);
$link_start = $link ? '<a href="' . esc_url( $link ) . '"' . flatsome_parse_target_rel( $link_atts ) . '>' : '';
$link_end = $link ? '</a>' : '';
// Get custom icons if set.
if ( ! empty( $custom ) ) {
return do_shortcode( '<div class="' . $classes . '">' . $link_start . flatsome_get_image( $custom ) . $link_end . '</div>' );
} elseif ( empty( $icons ) ) {
return false;
}
if ( ! is_array( $icons ) ) {
$icons = explode( ',', $icons );
}
ob_start();
echo '<div class="' . esc_attr( $classes ) . '">';
echo $link_start; // phpcs:disable WordPress.XSS.EscapeOutput.OutputNotEscaped
foreach ( $icons as $key => $value ) {
echo '<div class="payment-icon">';
get_template_part( 'assets/img/payment-icons/icon', $value . '.svg' );
echo '</div>';
}
echo '</div>';
echo $link_end; // phpcs:disable WordPress.XSS.EscapeOutput.OutputNotEscaped
$content = ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode( 'ux_payment_icons', 'ux_payment_icons' );

View File

@@ -0,0 +1,357 @@
<?php
// Flatsome Products
function ux_products($atts, $content = null, $tag = '' ) {
$sliderrandomid = rand();
if ( ! is_array( $atts ) ) {
$atts = array();
}
extract(shortcode_atts(array(
'_id' => 'product-grid-'.rand(),
'title' => '',
'ids' => '',
'style' => 'default',
'class' => '',
'visibility' => '',
// Ooptions
'back_image' => true,
// Layout
'columns' => '4',
'columns__sm' => '',
'columns__md' => '',
'col_spacing' => 'small',
'type' => 'slider', // slider, row, masonery, grid
'width' => '',
'grid' => '1',
'grid_height' => '600px',
'grid_height__md' => '500px',
'grid_height__sm' => '400px',
'slider_nav_style' => 'reveal',
'slider_nav_position' => '',
'slider_nav_color' => '',
'slider_bullets' => 'false',
'slider_arrows' => 'true',
'auto_slide' => '',
'infinitive' => 'true',
'depth' => '',
'depth_hover' => '',
'equalize_box' => 'false',
// posts
'products' => '8',
'cat' => '',
'excerpt' => 'visible',
'offset' => '',
'filter' => '',
// Posts Woo
'orderby' => '', // normal, sales, rand, date
'order' => '',
'tags' => '',
'show' => '', //featured, onsale
'out_of_stock' => '', // exclude.
// Box styles
'animate' => '',
'text_pos' => 'bottom',
'text_padding' => '',
'text_bg' => '',
'text_color' => '',
'text_hover' => '',
'text_align' => 'center',
'text_size' => '',
'image_size' => '',
'image_radius' => '',
'image_width' => '',
'image_height' => '',
'image_hover' => '',
'image_hover_alt' => '',
'image_overlay' => '',
'show_cat' => 'true',
'show_title' => 'true',
'show_rating' => 'true',
'show_price' => 'true',
'show_add_to_cart' => 'true',
'show_quick_view' => 'true',
), $atts));
// Stop if visibility is hidden
if($visibility == 'hidden') return;
$items = flatsome_ux_product_box_items();
$items['cat']['show'] = $show_cat;
$items['title']['show'] = $show_title;
$items['rating']['show'] = $show_rating;
$items['price']['show'] = $show_price;
$items['add_to_cart']['show'] = $show_add_to_cart;
$items['add_to_cart_icon']['show'] = $show_add_to_cart;
$items['quick_view']['show'] = $show_quick_view;
$items = flatsome_box_item_toggle_start( $items );
ob_start();
// if no style is set
if(!$style) $style = 'default';
$classes_box = array('box');
$classes_image = array();
$classes_text = array();
$classes_repeater = array( $class );
if ( $equalize_box === 'true' ) {
$classes_repeater[] = 'equalize-box';
}
// Fix product on small screens
if($style == 'overlay' || $style == 'shade'){
if(!$columns__sm) $columns__sm = 1;
}
if($tag == 'ux_bestseller_products') {
if(!$orderby) $atts['orderby'] = 'sales';
} else if($tag == 'ux_featured_products'){
$atts['show'] = 'featured';
} else if($tag == 'ux_sale_products'){
$atts['show'] = 'onsale';
} else if($tag == 'products_pinterest_style'){
$type = 'masonry';
$style = 'overlay';
$text_align = 'center';
$image_size = 'medium';
$text_pos = 'middle';
$text_hover = 'hover-slide';
$image_hover = 'overlay-add';
$class = 'featured-product';
$back_image = false;
$image_hover_alt = 'image-zoom-long';
} else if($tag == 'product_lookbook'){
$type = 'slider';
$style = 'overlay';
$col_spacing = 'collapse';
$text_align = 'center';
$image_size = 'medium';
$slider_nav_style = 'circle';
$text_pos = 'middle';
$text_hover = 'hover-slide';
$image_hover = 'overlay-add';
$image_hover_alt = 'zoom-long';
$class = 'featured-product';
$back_image = false;
}
// Fix grids
if($type == 'grid'){
if(!$text_pos) $text_pos = 'center';
if(!$text_color) $text_color = 'dark';
if($style !== 'shade') $style = 'overlay';
$columns = 0;
$current_grid = 0;
$grid = flatsome_get_grid($grid);
$grid_total = count($grid);
flatsome_get_grid_height($grid_height, $_id);
}
// Fix image size
if(!$image_size) $image_size = 'woocommerce_thumbnail';
// Add Animations
if($animate) {$animate = 'data-animate="'.$animate.'"';}
// Set box style
if($class) $classes_box[] = $class;
$classes_box[] = 'has-hover';
if($style) $classes_box[] = 'box-'.$style;
if($style == 'overlay') $classes_box[] = 'dark';
if($style == 'shade') $classes_box[] = 'dark';
if($style == 'badge') $classes_box[] = 'hover-dark';
if($text_pos) $classes_box[] = 'box-text-'.$text_pos;
if($style == 'overlay' && !$image_overlay) $image_overlay = true;
if($image_hover) $classes_image[] = 'image-'.$image_hover;
if($image_hover_alt) $classes_image[] = 'image-'.$image_hover_alt;
if($image_height) $classes_image[] = 'image-cover';
// Text classes
if($text_hover) $classes_text[] = 'show-on-hover hover-'.$text_hover;
if($text_align) $classes_text[] = 'text-'.$text_align;
if($text_size) $classes_text[] = 'is-'.$text_size;
if($text_color == 'dark') $classes_text[] = 'dark';
$css_args_img = array(
array( 'attribute' => 'border-radius', 'value' => $image_radius, 'unit' => '%'),
array( 'attribute' => 'width', 'value' => $image_width, 'unit' => '%' ),
);
$css_image_height = array(
array( 'attribute' => 'padding-top', 'value' => $image_height),
);
$css_args = array(
array( 'attribute' => 'background-color', 'value' => $text_bg ),
array( 'attribute' => 'padding', 'value' => $text_padding ),
);
// If default style
if($style == 'default'){
$depth = get_theme_mod('category_shadow');
$depth_hover = get_theme_mod('category_shadow_hover');
}
// Repeater styles
$repeater['id'] = $_id;
$repeater['title'] = $title;
$repeater['tag'] = $tag;
$repeater['class'] = implode( ' ', $classes_repeater );
$repeater['visibility'] = $visibility;
$repeater['type'] = $type;
$repeater['style'] = $style;
$repeater['slider_style'] = $slider_nav_style;
$repeater['slider_nav_color'] = $slider_nav_color;
$repeater['slider_nav_position'] = $slider_nav_position;
$repeater['slider_bullets'] = $slider_bullets;
$repeater['auto_slide'] = $auto_slide;
$repeater['infinitive'] = $infinitive;
$repeater['row_spacing'] = $col_spacing;
$repeater['row_width'] = $width;
$repeater['columns'] = $columns;
$repeater['columns__md'] = $columns__md;
$repeater['columns__sm'] = $columns__sm;
$repeater['filter'] = $filter;
$repeater['depth'] = $depth;
$repeater['depth_hover'] = $depth_hover;
get_flatsome_repeater_start($repeater);
?>
<?php
if(empty($ids)){
// Get products
$atts['products'] = $products;
$atts['offset'] = $offset;
$atts['cat'] = $cat;
$products = ux_list_products($atts);
} else {
// Get custom ids
$ids = explode( ',', $ids );
$ids = array_map( 'trim', $ids );
$args = array(
'post__in' => $ids,
'post_type' => 'product',
'numberposts' => -1,
'posts_per_page' => -1,
'orderby' => 'post__in',
'ignore_sticky_posts' => true,
);
$products = new WP_Query( $args );
}
if ( $products->have_posts() ) : ?>
<?php while ( $products->have_posts() ) : $products->the_post();
global $product;
if($style == 'default'){
wc_get_template_part( 'content', 'product' );
} else {
// Ensure visibility.
if ( empty( $product ) || false === wc_get_loop_product_visibility( $product->get_id() ) || ! $product->is_visible() ) {
continue;
}
$classes_col = array('col');
$out_of_stock = ! $product->is_in_stock();
if($out_of_stock) $classes[] = 'out-of-stock';
if($type == 'grid'){
if($grid_total > $current_grid) $current_grid++;
$current = $current_grid-1;
$classes_col[] = 'grid-col';
if($grid[$current]['height']) $classes_col[] = 'grid-col-'.$grid[$current]['height'];
if($grid[$current]['span']) $classes_col[] = 'large-'.$grid[$current]['span'];
if($grid[$current]['md']) $classes_col[] = 'medium-'.$grid[$current]['md'];
// Set image size
if($grid[$current]['size']) $image_size = $grid[$current]['size'];
}
?><div class="<?php echo implode(' ', $classes_col); ?>" <?php echo $animate;?>>
<div class="col-inner">
<?php woocommerce_show_product_loop_sale_flash(); ?>
<div class="product-small <?php echo implode(' ', $classes_box); ?>">
<div class="box-image" <?php echo get_shortcode_inline_css($css_args_img); ?>>
<div class="<?php echo implode(' ', $classes_image); ?>" <?php echo get_shortcode_inline_css($css_image_height); ?>>
<a href="<?php echo get_the_permalink(); ?>" aria-label="<?php echo esc_attr( $product->get_title() ); ?>">
<?php
if($back_image) flatsome_woocommerce_get_alt_product_thumbnail($image_size);
echo woocommerce_get_product_thumbnail($image_size);
?>
</a>
<?php if($image_overlay){ ?><div class="overlay fill" style="background-color: <?php echo $image_overlay;?>"></div><?php } ?>
<?php if($style == 'shade'){ ?><div class="shade"></div><?php } ?>
</div>
<div class="image-tools top right show-on-hover">
<?php do_action('flatsome_product_box_tools_top'); ?>
</div>
<?php if($style !== 'shade' && $style !== 'overlay') { ?>
<div class="image-tools <?php echo flatsome_product_box_actions_class(); ?>">
<?php do_action('flatsome_product_box_actions'); ?>
</div>
<?php } ?>
<?php if($out_of_stock) { ?><div class="out-of-stock-label"><?php _e( 'Out of stock', 'woocommerce' ); ?></div><?php }?>
</div>
<div class="box-text <?php echo implode(' ', $classes_text); ?>" <?php echo get_shortcode_inline_css($css_args); ?>>
<?php
do_action( 'woocommerce_before_shop_loop_item_title' );
echo '<div class="title-wrapper">';
do_action( 'woocommerce_shop_loop_item_title' );
echo '</div>';
echo '<div class="price-wrapper">';
do_action( 'woocommerce_after_shop_loop_item_title' );
echo '</div>';
if($style == 'shade' || $style == 'overlay') {
echo '<div class="overlay-tools">';
do_action('flatsome_product_box_actions');
echo '</div>';
}
do_action( 'flatsome_product_box_after' );
?>
</div>
</div>
</div>
</div><?php }
endwhile; // end of the loop.
endif;
wp_reset_query();
get_flatsome_repeater_end($repeater);
flatsome_box_item_toggle_end( $items );
$content = ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode("ux_bestseller_products", "ux_products");
add_shortcode("ux_featured_products", "ux_products");
add_shortcode("ux_sale_products", "ux_products");
add_shortcode("ux_latest_products", "ux_products");
add_shortcode("ux_custom_products", "ux_products");
add_shortcode("product_lookbook", "ux_products");
add_shortcode("products_pinterest_style", "ux_products");
add_shortcode("ux_products", "ux_products");

View File

@@ -0,0 +1,57 @@
<?php
// Flatsome Products
function ux_products_list($atts, $content = null, $tag = '' ) {
extract( $atts = shortcode_atts( array(
'title' => '',
'ids' => '',
'products' => '8',
'cat' => '',
'excerpt' => 'visible',
'offset' => '',
'orderby' => '', // normal, sales, rand, date
'order' => '',
'tags' => '',
'show' => '', //featured, onsale
'out_of_stock' => '', // exclude.
), $atts));
ob_start();
echo '<ul class="product_list_widget">';
if(empty($ids)){
$products = ux_list_products($atts);
} else {
// Get custom ids
$ids = explode( ',', $ids );
$ids = array_map( 'trim', $ids );
$args = array(
'post__in' => $ids,
'post_type' => 'product',
'numberposts' => -1,
'posts_per_page' => -1,
'orderby' => 'post__in',
'ignore_sticky_posts' => true,
);
$products = new WP_Query( $args );
}
if ( $products->have_posts() ) : ?>
<?php while ( $products->have_posts() ) : $products->the_post(); ?>
<?php wc_get_template_part( 'content', 'product-small' ); ?>
<?php endwhile; // end of the loop. ?>
<?php
endif;
wp_reset_query();
echo '</ul>';
$content = ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode("ux_products_list", "ux_products_list");

View File

@@ -0,0 +1,31 @@
<?php
function flatsome_sidebar_shortcode( $atts ){
extract( shortcode_atts( array(
'id' => 'sidebar-main',
'class' => '',
'visibility' => '',
'style' => ''
), $atts ) );
// Stop if visibility is hidden
if($visibility == 'hidden') return;
$classes = array( 'sidebar-wrapper' , 'ul-reset' );
if( $class ) $classes[] = $class;
if( $visibility ) $classes[] = $visibility;
if( $style ) $classes[] = 'widgets-'.$style;
$classes = implode(' ', $classes);
ob_start();
dynamic_sidebar($id);
$sidebar = trim( ob_get_clean() );
return '<ul class="'.$classes.'">'.$sidebar.'</ul>';
}
add_shortcode('ux_sidebar', 'flatsome_sidebar_shortcode');

View File

@@ -0,0 +1,150 @@
<?php // [ux_slider]
function shortcode_ux_slider($atts, $content=null) {
extract( shortcode_atts( array(
'_id' => 'slider-'.rand(),
'timer' => '6000',
'bullets' => 'true',
'visibility' => '',
'class' => '',
'type' => 'slide',
'bullet_style' => '',
'auto_slide' => 'true',
'auto_height' => 'true',
'bg_color' => '',
'slide_align' => 'center',
'style' => 'normal',
'slide_width' => '',
'arrows' => 'true',
'pause_hover' => 'true',
'hide_nav' => '',
'nav_style' => 'circle',
'nav_color' => 'light',
'nav_size' => 'large',
'nav_pos' => '',
'infinitive' => 'true',
'freescroll' => 'false',
'parallax' => '0',
'margin' => '',
'margin__md' => '',
'margin__sm' => '',
'columns' => '1',
'height' => '',
'rtl' => 'false',
'draggable' => 'true',
'friction' => '0.6',
'selectedattraction' => '0.1',
'threshold' => '10',
// Derpicated
'mobile' => 'true',
), $atts ) );
// Stop if visibility is hidden
if($visibility == 'hidden') return;
if($mobile !== 'true' && !$visibility) {$visibility = 'hide-for-small';}
ob_start();
$wrapper_classes = array('slider-wrapper', 'relative');
if( $class ) $wrapper_classes[] = $class;
if( $visibility ) $wrapper_classes[] = $visibility;
$wrapper_classes = implode(" ", $wrapper_classes);
$classes = array('slider');
if ($type == 'fade') $classes[] = 'slider-type-'.$type;
// Bullet style
if($bullet_style) $classes[] = 'slider-nav-dots-'.$bullet_style;
// Nav style
if($nav_style) $classes[] = 'slider-nav-'.$nav_style;
// Nav size
if($nav_size) $classes[] = 'slider-nav-'.$nav_size;
// Nav Color
if($nav_color) $classes[] = 'slider-nav-'.$nav_color;
// Nav Position
if($nav_pos) $classes[] = 'slider-nav-'.$nav_pos;
// Add timer
if($auto_slide == 'true') $auto_slide = $timer;
// Add Slider style
if($style) $classes[] = 'slider-style-'.$style;
// Always show Nav if set
if($hide_nav == 'true') {$classes[] = 'slider-show-nav';}
// Slider Nav visebility
$is_arrows = 'true';
$is_bullets = 'true';
if($arrows == 'false') $is_arrows = 'false';
if($bullets == 'false') $is_bullets = 'false';
if(is_rtl()) $rtl = 'true';
$classes = implode(" ", $classes);
// Inline CSS.
$css_args = array(
'bg_color' => array(
'attribute' => 'background-color',
'value' => $bg_color,
),
);
$args = array(
'margin' => array(
'selector' => '',
'property' => 'margin-bottom',
),
);
?>
<div class="<?php echo $wrapper_classes; ?>" id="<?php echo $_id; ?>" <?php echo get_shortcode_inline_css($css_args); ?>>
<div class="<?php echo $classes; ?>"
data-flickity-options='{
"cellAlign": "<?php echo $slide_align; ?>",
"imagesLoaded": true,
"lazyLoad": 1,
"freeScroll": <?php echo $freescroll; ?>,
"wrapAround": <?php echo $infinitive; ?>,
"autoPlay": <?php echo $auto_slide;?>,
"pauseAutoPlayOnHover" : <?php echo $pause_hover; ?>,
"prevNextButtons": <?php echo $is_arrows; ?>,
"contain" : true,
"adaptiveHeight" : <?php echo $auto_height;?>,
"dragThreshold" : <?php echo $threshold ;?>,
"percentPosition": true,
"pageDots": <?php echo $is_bullets; ?>,
"rightToLeft": <?php echo $rtl; ?>,
"draggable": <?php echo $draggable; ?>,
"selectedAttraction": <?php echo $selectedattraction; ?>,
"parallax" : <?php echo $parallax; ?>,
"friction": <?php echo $friction; ?>
}'
>
<?php echo do_shortcode( $content ); ?>
</div>
<div class="loading-spin dark large centered"></div>
<?php if($slide_width) { ?>
<style>
#<?php echo $_id; ?> .flickity-slider > * { max-width: <?php echo $slide_width; ?> !important; }
</style>
<?php } ?>
<?php echo ux_builder_element_style_tag( $_id, $args, $atts ); ?>
</div>
<?php
$content = ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode("ux_slider", "shortcode_ux_slider");

View File

@@ -0,0 +1,96 @@
<?php
/**
* Registers the `ux_stack` shortcode.
*
* @package flatsome
*/
/**
* Renders the `ux_stack` shortcode.
*
* @param array $atts An array of attributes.
* @param string $content The shortcode content.
* @param string $tag The name of the shortcode, provided for context to enable filtering.
*
* @return string
*/
function flatsome_render_ux_stack_shortcode( $atts, $content, $tag ) {
$atts = shortcode_atts(
array(
'visibility' => '',
'class' => '',
'direction' => 'row',
'direction__sm' => null,
'direction__md' => null,
'distribute' => 'start',
'distribute__sm' => null,
'distribute__md' => null,
'align' => 'stretch',
'align__sm' => null,
'align__md' => null,
'gap' => '0',
'gap__sm' => null,
'gap__md' => null,
),
$atts,
$tag
);
$id = 'stack-' . wp_rand();
$classes = array( 'stack' );
if ( ! empty( $atts['class'] ) ) $classes[] = $atts['class'];
if ( ! empty( $atts['visibility'] ) ) $classes[] = $atts['visibility'];
foreach ( array( '', 'sm', 'md' ) as $value ) {
$class_prefix = $value ? "$value:" : '';
$attr_suffix = $value ? "__$value" : '';
if ( $atts[ "direction{$attr_suffix}" ] ) {
$classes[] = "{$class_prefix}stack-{$atts["direction{$attr_suffix}"]}";
}
if ( $atts[ "distribute{$attr_suffix}" ] ) {
$classes[] = "{$class_prefix}justify-{$atts["distribute{$attr_suffix}"]}";
}
if ( $atts[ "align{$attr_suffix}" ] ) {
$classes[] = "{$class_prefix}items-{$atts["align{$attr_suffix}"]}";
}
}
wp_enqueue_script( 'css-vars-polyfill' );
ob_start();
?>
<div id="<?php echo esc_attr( $id ); ?>" class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>">
<?php echo do_shortcode( $content ); ?>
<?php
echo ux_builder_element_style_tag(
$id,
array(
'gap' => array(
'selector' => '> *',
'property' => '--stack-gap',
'unit' => 'rem',
),
),
$atts
);
?>
</div>
<?php
return ob_get_clean();
}
add_shortcode( 'ux_stack', 'flatsome_render_ux_stack_shortcode' );
add_shortcode( 'ux_stack_inner', 'flatsome_render_ux_stack_shortcode' );
add_shortcode( 'ux_stack_inner_1', 'flatsome_render_ux_stack_shortcode' );
add_shortcode( 'ux_stack_inner_2', 'flatsome_render_ux_stack_shortcode' );
add_shortcode( 'ux_stack_inner_4', 'flatsome_render_ux_stack_shortcode' );
add_shortcode( 'ux_stack_inner_5', 'flatsome_render_ux_stack_shortcode' );
add_shortcode( 'ux_stack_inner_6', 'flatsome_render_ux_stack_shortcode' );
add_shortcode( 'ux_stack_inner_7', 'flatsome_render_ux_stack_shortcode' );
add_shortcode( 'ux_stack_inner_8', 'flatsome_render_ux_stack_shortcode' );
add_shortcode( 'ux_stack_inner_9', 'flatsome_render_ux_stack_shortcode' );

View File

@@ -0,0 +1,76 @@
<?php
/**
* Registers the `ux_text` shortcode.
*
* @package flatsome
*/
/**
* Renders the `ux_text` shortcode.
*
* @param array $atts An array of attributes.
* @param string $content The shortcode content.
* @param string $tag The name of the shortcode, provided for context to enable filtering.
*
* @return string
*/
function flatsome_render_ux_text_shortcode( $atts, $content, $tag ) {
$atts = shortcode_atts(
array(
'visibility' => '',
'class' => '',
'font_size' => '',
'font_size__sm' => '',
'font_size__md' => '',
'line_height' => '',
'line_height__sm' => '',
'line_height__md' => '',
'text_align' => '',
'text_align__sm' => '',
'text_align__md' => '',
'text_color' => '',
),
$atts,
$tag
);
$id = 'text-' . wp_rand();
$classes = array( 'text' );
if ( ! empty( $atts['class'] ) ) $classes[] = $atts['class'];
if ( ! empty( $atts['visibility'] ) ) $classes[] = $atts['visibility'];
ob_start();
?>
<div id="<?php echo esc_attr( $id ); ?>" class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>">
<?php echo do_shortcode( $content ); ?>
<?php
echo ux_builder_element_style_tag(
$id,
array(
'font_size' => array(
'property' => 'font-size',
'unit' => 'rem',
),
'line_height' => array(
'property' => 'line-height',
),
'text_align' => array(
'property' => 'text-align',
),
'text_color' => array(
'selector' => ', > *',
'property' => 'color',
),
),
$atts
);
?>
</div>
<?php
return ob_get_clean();
}
add_shortcode( 'ux_text', 'flatsome_render_ux_text_shortcode' );

View File

@@ -0,0 +1,36 @@
<?php
// [trans]
//
if ( !function_exists( 'ux_wpml_shortcode' ) ){
function ux_wpml_shortcode(){
add_shortcode( 'uxtrans', 'uxtext_if_lang_sc');
add_shortcode( 'uxlang', 'uxtext_if_lang_sc');
}
add_action( 'init', 'ux_wpml_shortcode' );
function uxtext_if_lang_sc( $attr, $content = null ){
if ( !defined( 'ICL_LANGUAGE_CODE' ) ){
return '';
}
extract(shortcode_atts(array('lang' => '', 'code' => '', 'language' => '', ), $attr));
$lang = ( $code ) ? $code : $lang;
$lang = ( $language ) ? $language : $lang;
$lang = ( $lang ) ? $lang : ICL_LANGUAGE_CODE;
return uxtext_if_lang( $lang, $content );
}
}
if ( !function_exists( 'uxtext_if_lang' ) ){
function uxtext_if_lang( $lang, $content ){
if ( !defined( 'ICL_LANGUAGE_CODE' ) ){
return '';
}
if ( $lang === null ){
return '';
}
if ( ICL_LANGUAGE_CODE === $lang ){
return do_shortcode( $content );
} else {
return '';
}
}
}

View File

@@ -0,0 +1,31 @@
<?php // [ux_video]
function flatsome_video($atts) {
extract( shortcode_atts( array(
'class' => '',
'visibility' => '',
'url' => 'https://www.youtube.com/watch?v=AoPiLg8DZ3A',
'height' => '56.25%',
'depth' => '',
'depth_hover' => ''
), $atts ) );
$classes = array('video','video-fit','mb');
if ( $class ) $classes[] = $class;
if ( $visibility ) $classes[] = $visibility;
$video = apply_filters('the_content', $url);
if($depth) $classes[] = 'box-shadow-'.$depth;
if($depth_hover) $classes[] = 'box-shadow-'.$depth_hover.'-hover';
$classes = implode(' ', $classes);
$height = array(
array( 'attribute' => 'padding-top', 'value' => $height),
);
return '<div class="'.$classes.'" '.get_shortcode_inline_css($height).'>'.$video.'</div>';
}
add_shortcode("ux_video", "flatsome_video");