function ux_tabgroup_vertical($params, $content = null) { $GLOBALS['tabs'] = array(); $GLOBALS['tab_count'] = 0; $i = 1; $randomid = rand(); extract(shortcode_atts(array('title' => '', 'style' => 'normal'), $params)); $content = fixShortcode($content); if (is_array($GLOBALS['tabs'])) { foreach ($GLOBALS['tabs'] as $key => $tab) { $current = $key == 0 ? ' current-menu-item' : ''; // Set first menu item active by default. $active = $key == 0 ? ' active' : ''; // Set first tab active by default. $tabs[] = '<li class="tab' . $current . '"><a href="#panel' . $randomid . $i . '">' . $tab['title'] . '</a></li>'; $panes[] = '<div class="tabs-inner' . $active . '" id="panel' . $randomid . $i . '">' . fixShortcode($tab['content']) . '</div>'; $i++; } if ($title) { $title = '<h3>' . $title . '</h3>'; } $return = ' <div class="row collapse vertical-tabs shortcode_tabgroup_vertical pos_' . $style . '"> ' . $title . ' <div class="large-3 columns"><ul class="tabs-nav">' . implode("\n", $tabs) . '</ul></div><div class="large-9 columns">' . implode("\n", $panes) . '</div></div>'; } return $return; }
function uxLightboxShortcode($atts, $content = null) { $sliderrandomid = rand(); ob_start(); extract(shortcode_atts(array('id' => 'enter-id-here', 'width' => '600px', 'padding' => '20px', 'button' => '', 'button_text' => ''), $atts)); ?> <div id="<?php echo $id; ?> " class="mfp-hide my-mfp-zoom-in lightbox-white" style="max-width:<?php echo $width; ?> ;padding:<?php echo $padding; ?> "> <?php echo fixShortcode($content); ?> </div><!-- Lightbox-<?php echo $id; ?> --> <script> jQuery(document).ready(function($) { $('a[href="#<?php echo $id; ?> "]').addClass('open-popup-link-<?php echo $id; ?> '); $('.open-popup-link-<?php echo $id; ?> ').magnificPopup({ type:'inline', midClick: true, mainClass: 'my-mfp-zoom-in product-zoom-lightbox', removalDelay: 300 }); $('.open-popup-link-<?php echo $id; ?> ').click(function(e){ e.preventDefault(); }); }); </script> <?php $content = ob_get_contents(); ob_end_clean(); return $content; }
function ux_price_table($atts, $content = null) { extract(shortcode_atts(array('title' => 'Title', 'price' => '$99.99', 'description' => 'Description', 'button_style' => 'small alt-button', 'button_text' => 'Buy Now', 'button_link' => '', 'featured' => 'false'), $atts)); ob_start(); ?> <div class="ux_price_table text-center <?php if ($featured == 'true') { ?> featured-table box-shadow<?php } ?> "> <ul class="pricing-table"> <li class="title"><?php echo $title; ?> </li> <li class="price"><?php echo $price; ?> </li> <li class="description"><?php echo $description; ?> </li> <?php echo fixShortcode($content); ?> <?php if ($button_style) { ?> <li class="cta-button"><a class="button <?php echo $button_style; ?> " href="<?php echo $button_link; ?> "><?php echo $button_text; ?> </a></li> <?php } ?> </ul> </div> <?php $content = ob_get_contents(); ob_end_clean(); return $content; }
function message_box($atts, $content = null) { extract(shortcode_atts(array('bg' => '#333', 'text_color' => 'light'), $atts)); $color = "light"; if ($text_color == 'light') { $color = "dark"; } $background = ""; $background_color = ""; if (strpos($bg, 'http://') !== false) { $background = $bg; } elseif (strpos($bg, '#') !== false) { $background_color = 'background-color:' . $bg . '!important'; } else { $bg = wp_get_attachment_image_src($bg, 'large'); $background = $bg[0]; } $content = fixShortcode($content); return '<div class="message-box ' . $color . '" style="background-image:url(' . $background . ');' . $background_color . '"><div class="row"><div class="large-12 columns"><div class="inner">' . $content . '</div></div></div></div><!-- .message-box -->'; }
function featured_box($atts, $content = null) { $sliderrandomid = rand(); extract(shortcode_atts(array('title' => '', 'title_small' => '', 'img' => '', 'img_width' => '', 'pos' => '', 'link' => '', 'tooltip' => ''), $atts)); ob_start(); ?> <div class="featured-box <?php if ($pos) { echo 'pos-' . $pos; } ?> <?php if ($tooltip) { echo 'tip-top'; } ?> " data-tip="<?php echo $tooltip; ?> "> <div class="box-inner"> <?php if ($link) { echo '<a href="' . $link . '">'; } ?> <?php if ($img) { ?> <img class="featured-img" src="<?php echo $img; ?> " alt="<?php echo $title; ?> " style="<?php if ($img_width) { echo 'max-width:' . $img_width; } ?> "><?php } ?> <?php if ($link) { echo '</a>'; } ?> <?php if ($link) { echo '<a href="' . $link . '">'; } ?> <h4><?php echo $title; ?> <span><?php echo $title_small; ?> </span></h4> <?php if ($link) { echo '</a>'; } ?> <p><?php echo fixShortcode($content); ?> </p> </div> </div> <?php $content = ob_get_contents(); ob_end_clean(); return $content; }
function shortcode_map($atts, $content = null, $code) { $mapsrandomid = rand(); extract(shortcode_atts(array('lat' => '', 'long' => '', 'height' => '400px', 'color' => '#58728a', 'zoom' => '17', 'controls' => 'false', 'pan' => 'false'), $atts)); ob_start(); ?> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> 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": -30 } ] } ]}; 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: true, zoomControl: false, panControl: false, mapTypeControl: false, scaleControl: false, streetViewControl: false, overviewMapControl: false, scrollwheel: false, disableDoubleClickZoom: true } var map = new google.maps.Map(document.getElementById("<?php echo $mapsrandomid; ?> "), 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:"" }); } google.maps.event.addDomListener(window, 'load', initialize); google.maps.event.addDomListener(window, 'resize', initialize); </script> <div id="map_container"> <div id="<?php echo $mapsrandomid; ?> " style="height:<?php echo $height; ?> ;"></div> <div id="map_overlay_top"></div> <div id="map_overlay_bottom"></div> <?php if ($content) { ?> <div class="map-info"> <div class="row"> <div class="large-4 columns right"> <div class="map_inner"> <?php echo fixShortcode($content); ?> </div> <!-- map_inner --> </div><!-- large-4 --> </div><!-- row --> </div><!-- .map-info --> <?php } ?> </div> <?php $content = ob_get_contents(); ob_end_clean(); return $content; }
function ux_product_flip($atts, $content = null) { /* register script */ wp_register_script('flatsome-flip', get_template_directory_uri() . '/js/jquery.mobile.flip.js', array('jquery'), '20120202', true); wp_enqueue_script('flatsome-flip'); global $woocommerce; $sliderrandomid = rand(); extract(shortcode_atts(array('products' => '8', 'height' => '510px', 'cat' => ''), $atts)); ob_start(); if (!strpos($height, 'px') !== false) { $height = $height . 'px'; } $args = array('post_type' => 'product', 'post_status' => 'publish', 'product_cat' => $cat, 'products' => $products); ?> <div class="flip-container" style="height:<?php echo $height + 20; ?> px;overflow:hidden;"> <div class="row"> <div class="large-12 columns"> <div id="flipRoot" class="flipContainer"> <?php if ($content) { ?> <div class="row-collapse flip-slide"> <div class="large-12 columns"> <?php echo fixShortcode($content); ?> </div><!-- large-6 --> </div><!-- row --> <?php } ?> <?php $products = new WP_Query($args); if ($products->have_posts()) { ?> <?php while ($products->have_posts()) { $products->the_post(); ?> <div class="row collapse"> <?php woocommerce_get_template_part('content', 'product-flipbook'); ?> </div> <?php } // end of the loop. ?> <?php } wp_reset_query(); ?> </div> </div> </div> </div> <script type="text/javascript"> jQuery(document).ready(function($) { $("#flipRoot").flip({ height: '<?php echo $height; ?> ', forwardDir: 'ltor', showPager: true, loop: true }); }); </script> <style> /* -- product flip --*/ .flipShadow{display: none!important} .flipContainer{position:relative;-webkit-perspective:3000px;-moz-perspective:3000px;perspective:3000px;-webkit-user-select:none;-moz-user-select:none;user-select:none} .flipContent{position:absolute;top:0;left:0;height:100%;width:100%;display:none;overflow:hidden} .flipContent.flipCurrent{display:block} .sliding,.slidingBg{position:absolute;overflow:hidden;z-index:1;background-color:inherit} .flipping{background-color:inherit;-webkit-backface-visibility:hidden;-webkit-transform-style:flat;-webkit-transform:rotateY(0deg);-moz-backface-visibility:hidden;-moz-transform-style:preserve3d;-moz-transform:rotateY(0deg);backface-visibility:hidden;transform-style:preserve3d;transform:rotateY(0deg)} .flipping.firstHalf{-webkit-transform-origin:100% 0;-moz-transform-origin:100% 0;transform-origin:100% 0} .flipping.secondHalf{-webkit-transform-origin:0 0;-moz-transform-origin:0 0;transform-origin:0 0} .backflipping{display:none;background-color:inherit;-webkit-backface-visibility:hidden;-webkit-transform-style:flat;-webkit-transform:rotateY(180deg);-moz-backface-visibility:hidden;-moz-transform-style:flat;-moz-transform:rotateY(180deg);backface-visibility:hidden;transform-style:flat;transform:rotateY(180deg)} .holizontalFlipping.firstHalf{-webkit-transform-origin:100% 0;-moz-transform-origin:100% 0;transform-origin:100% 0} .holizontalFlipping.secondHalf{-webkit-transform-origin:0 0;-moz-transform-origin:0 0;transform-origin:0 0} .verticalFlipping.firstHalf{-webkit-transform-origin:0 100%;-moz-transform-origin:0 100%;transform-origin:0 100%} .verticalFlipping.secondHalf{-webkit-transform-origin:0 0;-moz-transform-origin:0 0;transform-origin:0 0} .splitHalf{position:absolute;overflow:hidden}.splitEmpty{background-color:#333} .flipContainer .pager{text-align:center;position:absolute;bottom:-10px;width:100%;cursor:pointer;overflow:hidden;} .flipContainer .pager span{display: inline-block;} .flip-slide{background: #FFF;} .flipContainer .callout{top:20px;left:20px;} .flipContainer .row-collapse {float:left!important;} .flipContainer .row-collapse > .columns{padding:0!important} .flipContainer .product-info{font-size: 80%; padding: 30px; overflow-y:auto} .flipContainer .star-rating{margin-bottom:15px;} .flipContainer .entry-title{padding:15px 50px 0 0;} .flipContainer .button{margin-top: 15px;} </style> <?php $content = ob_get_contents(); ob_end_clean(); return $content; }
function uxLightboxShortcode($atts, $content = null) { $sliderrandomid = rand(); ob_start(); extract(shortcode_atts(array('id' => 'enter-id-here', 'width' => '600px', 'padding' => '20px', 'auto_open' => false, 'auto_timer' => '2500', 'auto_show' => 'always'), $atts)); ?> <div id="<?php echo $id; ?> " class="mfp-hide mfp-content-inner lightbox-white" style="max-width:<?php echo $width; ?> ;padding:<?php echo $padding; ?> "> <?php echo fixShortcode($content); ?> </div><!-- Lightbox-<?php echo $id; ?> --> <script> jQuery(document).ready(function($) { <?php if ($auto_open) { ?> // auto open lightbox <?php if ($auto_show == 'always') { ?> $.removeCookie("lightbox_<?php echo $id; ?> ");<?php } ?> // run lightbox if no cookie is set if($.cookie("lightbox_<?php echo $id; ?> ") !== 'opened'){ // Open lightbox setTimeout(function(){ $.magnificPopup.open({midClick: true, removalDelay: 300, items: { src: '#<?php echo $id; ?> ', type: 'inline'}}); }, <?php echo $auto_timer; ?> ); // set cookie $.cookie("lightbox_<?php echo $id; ?> ", "opened"); } <?php } ?> $('a[href="#<?php echo $id; ?> "]').click(function(e){ // Close openend lightboxes var delay = 0; if($.magnificPopup.open){ $.magnificPopup.close(); delay = 300; } // Start lightbox setTimeout(function(){ $.magnificPopup.open({ midClick: true, removalDelay: 300, items: { src: '#<?php echo $id; ?> ', type: 'inline' } }); }, delay); e.preventDefault(); }); }); </script> <?php $content = ob_get_contents(); ob_end_clean(); return $content; }
function featured_box($atts, $content = null) { global $flatsome_opt; $sliderrandomid = rand(); extract(shortcode_atts(array('title' => '', 'title_small' => '', 'animated' => '', 'font_size' => '', 'bg' => '', 'img' => '', 'img_width' => '', 'pos' => '', 'link' => '', 'tooltip' => '', 'icon_border' => '0', 'icon_color' => $flatsome_opt['color_primary'], 'icon' => ''), $atts)); ob_start(); if ($font_size) { $font_size = 'font-size:' . $font_size; } ?> <div class="featured-box <?php if ($pos) { echo 'pos-' . $pos; } ?> <?php if ($tooltip) { echo 'tip-top'; } ?> " title="<?php echo $tooltip; ?> " style="<?php if ($pos == "left" && $img_width) { echo 'padding-left:' . ($img_width + 15) . 'px;'; } echo $font_size; ?> "> <div class="box-inner"> <?php if ($link) { echo '<a href="' . $link . '">'; } ?> <?php if ($img) { ?> <div class="featured-img <?php if ($animated) { echo 'scroll-animate'; } ?> <?php if ($icon_border) { ?> featured-img-circle <?php } ?> " <?php if ($animated) { echo 'data-animate="' . $animated . '"'; } ?> style="<?php if ($img_width) { ?> width:<?php echo $img_width; ?> ;max-height:<?php echo $img_width; ?> ;<?php } ?> <?php if ($icon_border) { ?> border-width:<?php echo $icon_border; ?> ; border-color:<?php echo $icon_color; } ?> "><?php if (strpos($img, '.jpg') !== false || strpos($img, '.gif') !== false || strpos($img, '.png') !== false) { $img = $img; } else { $img = wp_get_attachment_image_src($img, 'medium'); $img = $img[0]; } if (strpos($img, '.svg') !== false) { $svg = new SimpleXMLElement(file_get_contents($img)); $padding = "0"; if ($icon_border) { $padding = $img_width * 0.2; } echo '<svg viewBox="0 0 32 32" style="width:100%; fill:' . $icon_color . '; padding:' . $padding . 'px"'; echo '<g id="' . $svg->g->attributes()->id . '"><line stroke-width="1" x1="" y1="" x2="" y2="" opacity=""></line></g>'; echo '<path d="' . $svg->path->attributes()->d . '"></path>'; echo '</svg>'; } else { ?> <img src="<?php echo $img; ?> " alt="<?php echo $title; ?> " style="width:100%;"><?php } echo '</div><!-- end icon -->'; } ?> <?php if ($link) { echo '</a>'; } ?> <?php if ($link) { echo '<a href="' . $link . '">'; } ?> <h4><?php echo $title; ?> <span><?php echo $title_small; ?> </span></h4> <?php if ($link) { echo '</a>'; } ?> <?php echo fixShortcode($content); ?> </div> </div> <?php $content = ob_get_contents(); ob_end_clean(); return $content; }
function shortcode_ux_slider($atts, $content = null) { $sliderrandomid = rand(); ob_start(); extract(shortcode_atts(array('timer' => '5000', 'bullets' => 'true', 'auto_slide' => 'true', 'arrows' => 'true', 'hide_nav' => 'false', 'nav_color' => '', 'infinitive' => 'true', 'height' => '', 'column_padding' => ''), $atts)); ?> <div class="ux_slider_wrapper"> <div id="slider_<?php echo $sliderrandomid; ?> " class="iosSlider default" style="<?php if ($height) { echo 'min-height:' . $height . '; height:' . $height; } ?> "> <div class="slider"> <?php fixShortcode($content); ?> </div> <div class="sliderControlls <?php echo $nav_color; ?> <?php if ($hide_nav == 'false') { echo 'hide_nav'; } ?> "> <?php if ($arrows == 'true') { ?> <div class="sliderNav hide-for-small"> <a href="javascript:void(0)" class="nextSlide next_<?php echo $sliderrandomid; ?> "><span class="icon-angle-left"></span></a> <a href="javascript:void(0)" class="prevSlide prev_<?php echo $sliderrandomid; ?> "><span class="icon-angle-right"></span></a> </div> <?php } ?> <div class="sliderBullets"></div> </div><!-- .sliderControlls --> <div class="loading dark"><i></i><i></i><i></i><i></i></div> </div><!-- #slider --> <script type="text/javascript"> (function($){ $(window).load(function(){ $('#slider_<?php echo $sliderrandomid; ?> ').find('br').remove(); /* install slider */ $('#slider_<?php echo $sliderrandomid; ?> ').iosSlider({ snapToChildren: true, desktopClickDrag: true, snapFrictionCoefficient: 0.8, autoSlideTransTimer: 500, horizontalSlideLockThreshold:3, slideStartVelocityThreshold:3, infiniteSlider:<?php echo $infinitive; ?> , autoSlide: <?php echo $auto_slide; ?> , autoSlideTimer: <?php echo $timer; ?> , navPrevSelector: $('.next_<?php echo $sliderrandomid; ?> '), navNextSelector: $('.prev_<?php echo $sliderrandomid; ?> '), onSliderLoaded: startSlider, onSlideChange: slideChange, onSliderResize: slideResize, }); function slideChange(args) { $(args.sliderContainerObject).find('.inner').each(function(){ $(this).removeClass($(this).attr('data-animate')); }); $(args.sliderContainerObject).find('.scroll-animate').each(function(){ $(this).removeClass($(this).attr('data-animate')).removeClass('animated'); }); /* start text animation */ $(args.currentSlideObject).find('.inner').addClass($(args.currentSlideObject).find('.inner').attr('data-animate')); $(args.currentSlideObject).find('.scroll-animate').each(function(){ $(this).addClass('animated').addClass($(this).attr('data-animate')); }); /* change slider height */ var slide_height = $(args.currentSlideObject).outerHeight(); $(args.sliderContainerObject).css('min-height',slide_height); /* add current class to slide */ $(args.sliderContainerObject).find('.ux_banner').removeClass('current'); $(args.currentSlideObject).addClass('current'); /* update bullets */ $(args.sliderContainerObject).find('.sliderBullets .bullet').removeClass('active'); $(args.sliderContainerObject).find('.sliderBullets .bullet:eq(' + (args.currentSlideNumber - 1) + ')').addClass('active'); } function slideResize(args) { /* set height of first slide */ setTimeout(function(){ var slide_height = $(args.currentSlideObject).outerHeight(); $(args.sliderContainerObject).css('min-height',slide_height); $(args.sliderContainerObject).find('.ux_banner .center').vAlign(); },300); } function startSlider(args){ /* remove spinner when slider is loaded */ $(args.sliderContainerObject).find('.loading').fadeOut(); /* add current class to first slide */ $(args.currentSlideObject).addClass('current'); /* add parallax class if contains paralaxx slides */ $(args.sliderContainerObject).find('.ux_parallax').parent().parent().parent().addClass('parallax_slider'); /* animate first slide */ $(args.currentSlideObject).find('.inner').addClass($(args.currentSlideObject).find('.inner').attr('data-animate')); $(args.currentSlideObject).find('.scroll-animate').each(function(){ $(this).addClass('animated').addClass($(this).attr('data-animate')); }); /* set height of first slide */ var slide_height = $(args.currentSlideObject).outerHeight(); $(args.sliderContainerObject).css('min-height',slide_height); /* set text position */ $(args.sliderContainerObject).find('.ux_banner .center').vAlign(); <?php if ($bullets == 'true') { ?> /* add slider bullets */ var slide_id = 1; $(args.sliderContainerObject).find(".slider > *").each(function(){ $(args.sliderContainerObject).find('.sliderBullets').append('<div class="bullet" data-slide="'+slide_id+'"></div>'); slide_id++; }); /* add current class to bullets */ $(args.sliderContainerObject).find('.sliderBullets .bullet:first').addClass('active'); /* make bullets clickable */ $(args.sliderContainerObject).find('.bullet').click(function(){ $(args.sliderContainerObject).iosSlider('goToSlide', $(this).data('slide')); }); <?php } ?> } }) })(jQuery); </script> <?php if ($height) { ?> <style> @media only screen and (max-width: 768px) { #slider_<?php echo $sliderrandomid; ?> , #slider_<?php echo $sliderrandomid; ?> .slider > *, #slider_<?php echo $sliderrandomid; ?> .banner-bg{max-height:<?php echo $height * 0.9; ?> px!important;} } @media only screen and (max-width: 600px) { #slider_<?php echo $sliderrandomid; ?> , #slider_<?php echo $sliderrandomid; ?> .slider > *, #slider_<?php echo $sliderrandomid; ?> .banner-bg{max-height:<?php echo $height * 0.8; ?> px!important;} } @media only screen and (max-width: 500px) { #slider_<?php echo $sliderrandomid; ?> , #slider_<?php echo $sliderrandomid; ?> .slider > *, #slider_<?php echo $sliderrandomid; ?> .ux_banner{font-size: 8px} #slider_<?php echo $sliderrandomid; ?> , #slider_<?php echo $sliderrandomid; ?> .slider > *, #slider_<?php echo $sliderrandomid; ?> .banner-bg{max-height:<?php echo $height * 0.7; ?> px!important;} } @media only screen and (max-width: 400px) { #slider_<?php echo $sliderrandomid; ?> , #slider_<?php echo $sliderrandomid; ?> .slider > *, #slider_<?php echo $sliderrandomid; ?> .ux_banner{font-size: 6px} #slider_<?php echo $sliderrandomid; ?> , #slider_<?php echo $sliderrandomid; ?> .slider > *, #slider_<?php echo $sliderrandomid; ?> .banner-bg{max-height:<?php echo $height * 0.6; ?> px!important;} } </style> <?php } ?> <?php if ($column_padding) { ?> #slider_<?php echo $sliderrandomid; ?> .slider > .columns > *{padding:<?php echo $column_padding; ?> !important;} </style> <?php } ?> </div><!-- .ux_slider_wrapper --> <?php $content = ob_get_contents(); ob_end_clean(); return $content; }
function ux_product_flip($atts, $content = null) { global $woocommerce; $sliderrandomid = rand(); extract(shortcode_atts(array('products' => '8', 'cat' => ''), $atts)); ob_start(); $args = array('post_type' => 'product', 'post_status' => 'publish', 'product_cat' => $cat, 'products' => $products); ?> <div class="row"> <div class="large-12 columns flip-container"> <div class="flipContainer js-flickity slider-nav-circle slider-nav-slide-in" data-flickity-options='{ "cellAlign": "center", "wrapAround": true, "percentPosition": true, "imagesLoaded": true, "pageDots": true, "contain": true }'> <?php if ($content) { ?> <div class="row collapse"> <div class="large-12 columns"> <?php echo fixShortcode($content); ?> </div><!-- large-6 --> </div><!-- row --> <?php } ?> <?php $products = new WP_Query($args); if ($products->have_posts()) { ?> <?php while ($products->have_posts()) { $products->the_post(); ?> <?php woocommerce_get_template_part('content', 'product-flipbook'); ?> <?php } // end of the loop. ?> <?php } wp_reset_query(); ?> </div> </div> </div><!-- row --> <style> .flipContainer{ background: #FFF; box-shadow: 1px 1px 10px 0px rgba(0,0,0,.2); } .flipContainer .featured-product{ margin-bottom: 0; } .flip-slide .product-info{ padding: 10%; } .flip-slide .product_meta{ margin-bottom: 15px; } </style> <?php $content = ob_get_contents(); ob_end_clean(); return $content; }
function ux_banner_grid($atts, $content = null) { extract(shortcode_atts(array('width' => '', 'height' => '600px', 'grid' => '', 'padding' => '15px'), $atts)); $shortcode_id = rand(); ob_start(); ?> <?php if ($padding && $grid) { $padding_w = $padding / 2; ?> <style> #banner_grid_<?php echo $shortcode_id; ?> .ux_banner-grid{margin-left: -<?php echo $padding_w; ?> px !important; margin-right: -<?php echo $padding_w; ?> px !important;} #banner_grid_<?php echo $shortcode_id; ?> .ux_banner-grid .columns{margin-bottom: <?php echo $padding; ?> !important} #banner_grid_<?php echo $shortcode_id; ?> .ux_banner-grid .columns > .column-inner{padding-left: <?php echo $padding_w; ?> px !important; padding-right: <?php echo $padding_w; ?> px !important;} </style> <?php } ?> <div id="banner_grid_<?php echo $shortcode_id; ?> "> <div class="row"> <div class="large-12 columns"> <div class="row collapse ux_banner-grid ux_banner-grid-new"> <?php if ($grid) { $pattern = get_shortcode_regex(); if (preg_match_all('/' . $pattern . '/s', $content, $matches) && array_key_exists(2, $matches) && in_array('ux_banner', $matches[2])) { $tall_height = $height; $less_tall_height = $height - $height / 3 - $padding / 2 . 'px'; $small_height = $height / 2 - $padding / 2 . 'px'; $smallest_height = $height / 3 - $padding / 1.5 . 'px'; $g_total = ''; $id = '1'; if ($grid == '1') { $g_total = '5'; $g = array('height1' => $tall_height, 'span1' => 'large-6 small-12', 'height2' => $tall_height, 'span2' => 'large-3 small-6', 'height3' => $small_height, 'span3' => 'large-3 small-6', 'height4' => $small_height, 'span4' => 'large-3 small-6', 'height5' => $small_height, 'span5' => 'large-3 small-6'); } if ($grid == '2') { $g_total = '4'; $g = array('height1' => $tall_height, 'span1' => 'large-12 small-12', 'height2' => $smallest_height, 'span2' => 'large-4 small-12', 'height3' => $smallest_height, 'span3' => 'large-4 small-12', 'height4' => $smallest_height, 'span4' => 'large-4 small-12'); } if ($grid == '3') { $g_total = '3'; $g = array('height1' => $tall_height, 'span1' => 'large-6 small-12', 'height2' => $small_height, 'span2' => 'large-6 small-6', 'height3' => $small_height, 'span3' => 'large-3 small-6'); } if ($grid == '4') { $g_total = '1'; $g = array('height1' => $tall_height, 'span1' => 'large-3 small-6'); } if ($grid == '5') { $g_total = '1'; $g = array('height1' => $tall_height, 'span1' => 'large-4 small-6'); } if ($grid == '6') { $g_total = '3'; $g = array('height1' => $tall_height, 'span1' => 'large-9 small-12', 'height2' => $small_height, 'span2' => 'large-3 small-6', 'height3' => $small_height, 'span3' => 'large-3 small-6'); } if ($grid == '7') { $g_total = '3'; $g = array('height1' => $tall_height, 'span1' => 'large-3 small-6', 'height2' => $tall_height, 'span2' => 'large-6 small-12', 'height3' => $small_height, 'span3' => 'large-3 small-6'); } if ($grid == '8') { $g_total = '3'; $g = array('height1' => $tall_height, 'span1' => 'large-3 small-6', 'height2' => $tall_height, 'span2' => 'large-6 small-12', 'height3' => $tall_height, 'span3' => 'large-3 small-6'); } if ($grid == '9') { $g_total = '2'; $g = array('height1' => $tall_height, 'span1' => 'large-6 small-12', 'height2' => $small_height, 'span2' => 'large-3 small-6'); } if ($grid == '10') { $g_total = '5'; $g = array('height1' => $tall_height, 'span1' => 'large-6 small-12', 'height2' => $smallest_height, 'span2' => 'large-6 small-12', 'height3' => $smallest_height, 'span3' => 'large-3 small-12', 'height4' => $smallest_height, 'span4' => 'large-3 small-12', 'height5' => $smallest_height, 'span5' => 'large-6 small-12'); } if ($grid == '11') { $g_total = '5'; $g = array('height1' => $less_tall_height, 'span1' => 'large-6 small-12', 'height2' => $less_tall_height, 'span2' => 'large-3 small-12', 'height3' => $tall_height, 'span3' => 'large-3 small-12', 'height4' => $smallest_height, 'span4' => 'large-3 small-12', 'height5' => $smallest_height, 'span5' => 'large-6 small-12'); } if ($grid == '12') { $g_total = '6'; $g = array('height1' => $smallest_height, 'span1' => 'large-8 small-12', 'height2' => $smallest_height, 'span2' => 'large-4 small-12', 'height3' => $smallest_height, 'span3' => 'large-4 small-12', 'height4' => $smallest_height, 'span4' => 'large-8 small-12', 'height5' => $smallest_height, 'span5' => 'large-8 small-12', 'height6' => $smallest_height, 'span6' => 'large-4 small-12'); } if ($grid == '13') { $g_total = '6'; $g = array('height1' => $less_tall_height, 'span1' => 'large-6 small-12', 'height2' => $small_height, 'span2' => 'large-3 small-12', 'height3' => $tall_height, 'span3' => 'large-3 small-12', 'height4' => $smallest_height, 'span4' => 'large-6 small-12', 'height5' => $small_height, 'span5' => 'large-3 small-12', 'height6' => $smallest_height, 'span6' => 'large-6 small-12'); } if ($grid == '14') { $g_total = '6'; $g = array('height1' => $smallest_height, 'span1' => 'large-9 small-12', 'height2' => $tall_height, 'span2' => 'large-3 small-12', 'height3' => $less_tall_height, 'span3' => 'large-3 small-12', 'height4' => $smallest_height, 'span4' => 'large-3 small-12', 'height5' => $smallest_height, 'span5' => 'large-3 small-12', 'height6' => $smallest_height, 'span6' => 'large-6 small-12'); } // Build grid foreach ($matches[0] as $shortcode) { $grid_class = ''; if ($g['height' . $id] < '200px') { $grid_class = 'grid-small-height'; } else { if ($g['height' . $id] < '300px') { $grid_class = 'grid-medium-height'; } } echo '<div class="columns ux-grid-column ' . $grid_class . ' ' . $g['span' . $id] . '" style="height:' . $g['height' . $id] . '"><div class="column-inner">'; echo fixShortcode($shortcode); echo '</div></div>'; if ($id < $g_total) { $id++; } } } } else { echo fixShortcode($content); } ?> </div> </div> </div> <script> jQuery(document).ready(function ($) { var $container = $("#banner_grid_<?php echo $shortcode_id; ?> .ux_banner-grid"); $container.packery({ itemSelector: ".columns", gutter: 0 }); }); </script> </div><!-- #banner-grid --> <?php $content = ob_get_contents(); ob_end_clean(); return $content; }
function ux_accordion_item($atts, $content = null, $code) { extract(shortcode_atts(array('title' => ''), $atts)); return '<div class="accordion-title"><a href="#">' . $title . '</a></div><div class="accordion-inner">' . fixShortcode($content) . '</div>'; }
function team_member($atts, $content = null) { $sliderrandomid = rand(); extract(shortcode_atts(array("name" => '', "title" => '', 'twitter' => '', 'facebook' => '', 'pinterest' => '', 'instagram' => '', 'email' => '', 'img' => '', 'tel' => '', 'linkedin' => '', 'style' => 'text-circle'), $atts)); ob_start(); if (strpos($img, 'http://') !== false || strpos($img, 'https://') !== false) { $img = $img; } else { $img = wp_get_attachment_image_src($img, 'thumbnail'); $img = $img[0]; } ?> <div class="ux-box team-member ux-<?php echo $style; ?> <?php if ($style == 'text-overlay') { echo 'dark'; } ?> text-center"> <div class="inner"> <div class="inner-wrap"> <div class="ux-box-image"> <img src="<?php echo $img; ?> " /> </div><!-- .ux-box-image --> <div class="ux-box-text <?php if ($style == 'text-overlay') { ?> show-first<?php } ?> "> <h4 class="uppercase"> <?php echo $name; ?> <br/> <span class="thin-font"><?php echo $title; ?> </span> </h4> <div class="show-next"> <div class="tx-div small"></div> <div class="social-icons"> <?php if ($tel) { ?> <a href="tel:<?php echo $tel; ?> " target="_blank" class="icon icon_email tip-top" title="<?php echo $tel; ?> "><span class="icon-phone"></span></a> <?php } ?> <?php if ($facebook) { ?> <a href="<?php echo $facebook; ?> " target="_blank" class="icon icon_facebook tip-top" title="<?php echo $facebook; ?> "><span class="icon-facebook"></span></a> <?php } ?> <?php if ($twitter) { ?> <a href="<?php echo $twitter; ?> " target="_blank" class="icon icon_twitter tip-top" title="<?php echo $twitter; ?> "><span class="icon-twitter"></span></a> <?php } ?> <?php if ($email) { ?> <a href="mailto:<?php echo $email; ?> " target="_blank" class="icon icon_email tip-top" title="<?php echo $email; ?> "><span class="icon-envelop"></span></a> <?php } ?> <?php if ($pinterest) { ?> <a href="<?php echo $pinterest; ?> " target="_blank" class="icon icon_pintrest tip-top" title="<?php echo $pinterest; ?> "><span class="icon-pinterest"></span></a> <?php } ?> <?php if ($instagram) { ?> <a href="<?php echo $instagram; ?> " target="_blank" class="icon icon_instagram tip-top" title="<?php echo $instagram; ?> "><span class="icon-instagram"></span></a> <?php } ?> <?php if ($linkedin) { ?> <a href="<?php echo $linkedin; ?> " target="_blank" class="icon icon_linkedin tip-top" title="<?php echo $linkedin; ?> "><span class="icon-linkedin"></span></a> <?php } ?> </div> </div> <p><?php if ($style != 'text-overlay') { echo fixShortcode($content); } ?> </p> </div><!-- .ux-box-text-overlay --> </div> </div> </div> <?php if ($style == 'text-overlay') { ?> <div class="small-font" style="margin-top:15px;"><?php echo fixShortcode($content); ?> </div> <?php } ?> <?php $content = ob_get_contents(); ob_end_clean(); return $content; }
function uxbannerShortcode($atts, $content = null) { global $flatsome_opt; $bannerid = rand(); extract(shortcode_atts(array('text_pos' => 'center', 'height' => '300px', 'text_color' => 'light', 'bg_color' => '', 'link' => '', 'text_width' => '60%', 'text_align' => 'center', 'mob_height' => '', 'tablet_height' => '', 'animation' => 'fadeIn', 'animate' => '', 'animated' => '', 'animation_duration' => '', 'youtube' => '', 'effect' => '', 'video_mp4' => '', 'video_ogg' => '', 'video_webm' => '', 'video_sound' => 'false', 'video_loop' => 'loop', 'hover' => '', 'bg' => '', 'parallax' => '', 'parallax_text' => '', 'text_bg' => '', 'text_bg_opacity' => '0.9', 'padding' => '30px', 'target' => '', 'bg_overlay' => '', 'class' => ''), $atts)); ob_start(); if ($animate) { $animation = $animate; } if ($animated) { $animation = $animated; } $color = "light"; if ($text_color == 'light') { $color = "dark"; } if ($hover) { $hover = 'hover_' . $hover; } $animated = ""; if ($animation != "none") { $animated = "animated"; } $start_link = ""; $end_link = ""; if ($link) { $start_link = '<a href="' . $link . '">'; $end_link = '</a>'; } if ($bg_color) { $bg_color = ' background-color:' . $bg_color; } $background = ""; if (strpos($bg, 'http://') !== false || strpos($bg, 'https://') !== false) { $background = $bg; } elseif (strpos($bg, '#') !== false) { $bg_color = ' background-color:' . $bg . '!important'; } else { $bg = wp_get_attachment_image_src($bg, 'large'); $background = $bg[0]; } $textalign = ""; if ($text_align) { $textalign = "text-" . $text_align; } $parallax_velocity = '0.' . $parallax; $parallax_class = ''; if ($parallax) { $parallax_class = ' ux_parallax'; $parallax = 'data-velocity="0.' . $parallax . '"'; } $text_parallax_class = ''; if ($parallax_text) { $text_parallax_class = ' parallax_text'; $parallax_text = 'data-velocity="0.' . $parallax_text . '"'; } ?> <div id="banner_<?php echo $bannerid; ?> " class="ux_banner <?php echo $color; ?> <?php echo $class; ?> <?php if ($height == '100%') { echo 'full-height'; } ?> <?php echo $hover; ?> <?php if (!$bg && !$bg_color) { ?> bg-trans<?php } ?> " style="height:<?php echo $height; ?> ; <?php echo $bg_color; ?> " data-height="<?php echo $height; ?> " role="banner"> <?php echo $start_link; ?> <?php if ($youtube) { ?> <div id="ytplayer" class="ux-youtube <?php echo $parallax_class; ?> "></div> <?php } ?> <?php if ($bg || $bg_color) { ?> <?php if ($bg_overlay) { echo '<div class="bg-overlay" style="background-color:' . ux_hex2rgba($bg_overlay, '0.15') . '"></div>'; } ?> <div class="banner-bg<?php echo $parallax_class; ?> " <?php if ($parallax) { echo $parallax; } ?> style="background-image:url('<?php echo $background; ?> '); <?php echo $bg_color; ?> "><?php if ($background) { ?> <img src="<?php echo $background; ?> " style="visibility:hidden;" /><?php } ?> </div> <?php } ?> <?php if ($video_mp4 || $video_webm || $video_ogg) { ?> <div class="video-overlay"></div> <video class="ux-banner-video hide-for-small" <?php if ($parallax) { echo $parallax; } ?> poster="<?php echo $background; ?> " preload="auto" autoplay="" loop="<?php echo $video_loop; ?> " <?php if ($video_sound == 'false') { echo "muted='muted'"; } ?> > <source src="<?php echo $video_mp4; ?> " type="video/mp4"> <source src="<?php echo $video_webm; ?> " type="video/webm"> <source src="<?php echo $video_ogg; ?> " type="video/ogg"> </video> <?php } ?> <?php if ($effect) { wp_enqueue_style('flatsome-effect'); ?> <div class="banner-effect effect-<?php echo $effect; ?> "></div> <?php } ?> <div class="row<?php if ($parallax_text) { echo ' parallax_text'; } echo $text_parallax_class; ?> " <?php if ($parallax_text) { echo $parallax_text; } ?> > <div class="inner <?php echo $text_pos; ?> <?php echo $textalign; ?> <?php if ($text_bg) { echo 'text-boxed'; } ?> " style="width:<?php echo $text_width; ?> ;"> <div class="inner-wrap <?php echo $animated; ?> " data-animate="<?php echo $animation; ?> " style="<?php if ($text_bg) { echo 'background-color:' . ux_hex2rgba($text_bg, $text_bg_opacity) . ';'; } ?> <?php if ($text_bg) { echo 'padding:' . $padding; } ?> "> <?php echo fixShortcode($content); ?> </div> </div> </div> <?php echo $end_link; ?> <?php if ($mob_height || $tablet_height || $animation_duration) { ?> <style> <?php if ($tablet_height) { ?> @media only screen and (max-width: 768px) { #banner_<?php echo $bannerid; ?> { height:<?php echo $tablet_height; ?> !important} } <?php } // mob height ?> <?php if ($mob_height) { ?> @media only screen and (max-width: 480px) { #banner_<?php echo $bannerid; ?> { height:<?php echo $mob_height; ?> !important} } <?php } // mob height ?> <?php if ($animation_duration) { ?> #banner_<?php echo $bannerid; ?> .inner-animate{ animation-duration:<?php echo $animation_duration; ?> ; -webkit-animation-duration:<?php echo $animation_duration; ?> ; -moz-animation-duration:<?php echo $animation_duration; ?> ; -o-animation-duration:<?php echo $animation_duration; ?> ; } <?php } // End animation duration ?> </style> <?php } ?> </div><!-- end .ux_banner --> <?php if ($youtube) { ?> <!-- Youtube script --> <script> // Load the IFrame Player API code asynchronously. var tag = document.createElement('script'); tag.src = "https://www.youtube.com/player_api"; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); // Replace the 'ytplayer' element with an <iframe> and // YouTube player after the API code downloads. var player; function onYouTubePlayerAPIReady() { player = new YT.Player('ytplayer', { height: '100%', width: '100%', playerVars: { autoplay: 1, controls: 0, showinfo: 0, fs :0, loop:1, el: 0}, videoId: '<?php echo $youtube; ?> ', events: { 'onReady': onPlayerReady} } ); } function onPlayerReady(event) { <?php if ($video_sound == 'false') { echo 'event.target.mute();'; } ?> } </script> <?php } $content = ob_get_contents(); ob_end_clean(); return $content; }
function backgroundSlideShortcode($atts, $content = null) { extract(shortcode_atts(array('bg' => '', 'padding' => '', 'dark' => 'false', 'class' => '', 'video_mp4' => '', 'video_ogv' => '', 'video_webm' => '', 'parallax' => '', 'parallax_text' => '', 'margin' => '0px', 'title' => '', 'img' => '', 'img_pos' => 'right', 'img_width' => '50%', 'img_margin' => '', 'id' => '', 'bgs' => '', 'bgs_interval' => 5000, 'mobile' => true), $atts)); ob_start(); $background = ""; $background_color = ""; $padding_row = ""; $dark_text = ""; if ($dark == 'true') { $dark_text = " dark"; } if ($padding) { $padding_row = 'padding:' . $padding . ' 0;'; } if (strpos($bg, 'http://') !== false || strpos($bg, 'https://') !== false) { $background = $bg; } elseif (strpos($bg, '#') !== false) { $background_color = 'background-color:' . $bg . '!important;'; } $bgs = explode('|', $bgs); if (!empty($bgs) && is_array($bgs)) { $background = $bgs[0]; } $has_parallax = ''; if ($parallax || $parallax_text) { $has_parallax = ' has-parallax'; } $parallax_class = ''; if ($parallax) { $parallax_class = ' ux_parallax'; $parallax = ' data-velocity="' . intval($parallax) / 10 . '"'; } $parallax_text = ''; $text_parallax_class = ''; if ($parallax_text) { $text_parallax_class = ' parallax_text'; $parallax_text = ' data-velocity="' . intval($parallax_text) / 10 . '"'; } ?> <?php if ($title) { ?> <h3 class="ux-bg-title"><span><?php echo $title; ?> </span></h3> <?php } ?> <section <?php if ($id) { echo 'id="' . $id . '"'; } ?> class="ux-section<?php echo $dark_text; if ($img) { echo ' has-img has-img-' . $img_pos; } if ($class) { echo ' ' . $class; } echo $has_parallax; ?> " style="<?php echo $background_color; echo $padding_row; if ($margin) { echo 'margin-bottom:' . $margin . '!important;'; } ?> "> <?php if ($background) { ?> <div class="bach-background-slide<?php if ($id) { echo "-" . $id; } ?> ux-section-bg banner-bg <?php echo $parallax_class; ?> " <?php echo $parallax; ?> style="background-image:url(<?php echo $background; ?> );"></div><?php } ?> <?php if ($img && $img_pos != 'bottom') { ?> <div class="ux-section-img <?php echo $img_pos; ?> " style="width:<?php echo $img_width; ?> ; background-image: url('<?php echo $img; ?> ');<?php if ($img_margin) { echo 'margin:' . $img_margin . ' 0;'; } ?> "><img src="<?php echo $img; ?> "></div><?php } ?> <div class="ux-section-content<?php echo $text_parallax_class; echo $text_parallax_class; ?> "<?php echo $parallax_text; ?> ><?php echo fixShortcode($content); ?> </div> <?php if ($img && $img_pos == 'bottom') { ?> <div class="ux-section-img <?php echo $img_pos; ?> " style="width:<?php echo $img_width; ?> ; background-image: url('<?php echo $img; ?> ');"><img src="<?php echo $img; ?> "></div><?php } ?> <?php if ($video_mp4 || $video_webm || $video_ogv) { ?> <video class="ux-banner-video hide-for-small" poster="<?php echo $background; ?> " preload="auto" autoplay="" loop="loop" muted="muted"> <source src="<?php echo $video_mp4; ?> " type="video/mp4"> <source src="<?php echo $video_webm; ?> " type="video/webm"> <source src="<?php echo $video_ogg; ?> " type="video/ogg"> </video> <?php } ?> </section><!-- .ux-section --> <?php if (!empty($bgs) && is_array($bgs)) { ?> <script type="text/javascript"> jQuery(function($){ var listBgs = []; <?php foreach ($bgs as $item) { ?> listBgs.push('<?php echo $item; ?> '); <?php } ?> var cnt=0, bg; var backgroundItem = $('.bach-background-slide<?php if ($id) { echo "-" . $id; } ?> '); var $body = $(backgroundItem); var bgrotater = setInterval(function() { if (cnt==listBgs.length) cnt=0; bg = 'url("' + listBgs[cnt] + '")'; cnt++; $body.css({'background-image': bg, 'background-size':'cover', 'transition': '1.5s'}); }, <?php echo !empty($bgs_interval) ? $bgs_interval : 5000; ?> ); }); </script> <?php } ?> <?php $content = ob_get_contents(); ob_end_clean(); return $content; }
function colShortcode($atts, $content = null) { extract(shortcode_atts(array('span' => '12', 'animate' => '', 'small' => '12', 'padding' => '', 'tooltip' => '', 'delay' => '', 'hover' => '', 'class' => '', 'align' => '', 'parallax' => '', 'bg' => ''), $atts)); switch ($span) { case "1/1": $span = '12'; break; case "1/4": $span = '3'; break; case "2/4": $span = '6'; break; case "3/4": $span = '9'; break; case "1/3": $span = '4'; break; case "2/3": $span = '8'; break; case "1/2": $span = '6'; break; case "1/6": $span = '2'; break; case "2/6": $span = '4'; break; case "3/6": $span = '6'; break; case "4/6": $span = '8'; break; case "5/6": $span = '10'; break; case "1/12": $span = '1'; break; case "2/12": $span = '2'; break; case "3/12": $span = '3'; break; case "4/12": $span = '4'; break; case "5/12": $span = '5'; break; case "6/12": $span = '6'; break; case "7/12": $span = '7'; break; case "8/12": $span = '8'; break; case "9/12": $span = '9'; break; case "10/12": $span = '10'; break; case "11/12": $span = '11'; break; } // SCROLL HTML $scroll = ''; $scroll_html = ''; if ($animate) { $scroll = 'scroll-animate'; $scroll_html = 'data-animate="' . $animate . '"'; } if ($align) { $align = ' text-' . $align . ' '; } // DELAY HTML $delay_html = ''; if ($delay) { $delay_html = 'style="-webkit-animation-delay: ' . $delay . ';animation-delay: ' . $delay . ';-moz-animation-delay: ' . $delay . ';"'; } // HOVER HTML if ($hover) { $hover = 'col_hover_' . $hover; } // PADDING HTML if ($padding) { $padding = 'style="padding:' . $padding . '"'; } // TOOLTIP $tooltip_class = ''; if ($tooltip) { $tooltip = 'title="' . $tooltip . '"'; $tooltip_class = 'tip-top'; } // Background $bg_class = ''; if ($bg) { $bg = 'background-color:' . $bg; $bg_class = 'col-bg'; } // Parallax $parallax_html = ''; $text_parallax_class = ''; if ($parallax) { $text_parallax_class = ' parallax_text'; $parallax_html = ' data-velocity="-0.' . $parallax . '"'; } $column = '<div class="small-' . $small . '' . $align . ' ' . $bg_class . ' ' . $tooltip_class . ' ' . $class . ' large-' . $span . ' ' . $hover . ' columns ' . $scroll . '" ' . $tooltip . ' ' . $scroll_html . ' ' . $delay_html . '><div class="column-inner' . $text_parallax_class . '" ' . $parallax_html . ' ' . $padding . '>' . $content . '</div></div>'; return fixShortcode($column); }
function ux_product_categories_grid($atts, $content = null) { extract(shortcode_atts(array('number' => 9999, 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 0, 'parent' => '', 'height' => '600px', 'grid' => '1', 'padding' => '15px', 'offset' => '', 'bg_overlay' => '#000'), $atts)); $hide_empty = $hide_empty == true || $hide_empty == 1 ? 1 : 0; $args = array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'pad_counts' => true, 'child_of' => $parent, 'offset' => $offset); $product_categories = get_terms('product_cat', $args); if ($parent !== "") { $product_categories = wp_list_filter($product_categories, array('parent' => $parent)); } if ($number) { $product_categories = array_slice($product_categories, 0, $number); } $bannergridID = rand(); $tall_height = $height; $less_tall_height = $height - $height / 3 - $padding / 2 . 'px'; $small_height = $height / 2 - $padding / 2 . 'px'; $smallest_height = $height / 3 - $padding / 1.5 . 'px'; $g_total = '0'; if ($grid == '1') { $g_total = '5'; $g = array('height1' => $tall_height, 'span1' => 'large-6 small-12', 'height2' => $tall_height, 'span2' => 'large-3 small-6', 'height3' => $small_height, 'span3' => 'large-3 small-6', 'height4' => $small_height, 'span4' => 'large-3 small-6', 'height5' => $small_height, 'span5' => 'large-3 small-6'); } if ($grid == '2') { $g_total = '4'; $g = array('height1' => $tall_height, 'span1' => 'large-12 small-12', 'height2' => $smallest_height, 'span2' => 'large-4 small-12', 'height3' => $smallest_height, 'span3' => 'large-4 small-12', 'height4' => $smallest_height, 'span4' => 'large-4 small-12'); } if ($grid == '3') { $g_total = '3'; $g = array('height1' => $tall_height, 'span1' => 'large-6 small-12', 'height2' => $small_height, 'span2' => 'large-6 small-6', 'height3' => $small_height, 'span3' => 'large-3 small-6'); } if ($grid == '4') { $g_total = '1'; $g = array('height1' => $tall_height, 'span1' => 'large-3 small-6'); } if ($grid == '5') { $g_total = '1'; $g = array('height1' => $tall_height, 'span1' => 'large-4 small-6'); } if ($grid == '6') { $g_total = '4'; $g = array('height1' => $tall_height, 'span1' => 'large-8 small-12', 'height2' => $small_height, 'span2' => 'large-4 small-6', 'height3' => $small_height, 'span3' => 'large-4 small-6', 'height4' => $small_height, 'span4' => 'large-4 small-6'); } if ($grid == '7') { $g_total = '4'; $g = array('height1' => $tall_height, 'span1' => 'large-3 small-6', 'height2' => $tall_height, 'span2' => 'large-6 small-12', 'height3' => $small_height, 'span3' => 'large-3 small-6', 'height4' => $small_height, 'span4' => 'large-3 small-6'); } if ($grid == '8') { $g_total = '4'; $g = array('height1' => $tall_height, 'span1' => 'large-3 small-6', 'height2' => $tall_height, 'span2' => 'large-6 small-12', 'height3' => $tall_height, 'span3' => 'large-3 small-6', 'height4' => $small_height, 'span4' => 'large-3 small-6'); } if ($grid == '9') { $g_total = '2'; $g = array('height1' => $tall_height, 'span1' => 'large-6 small-12', 'height2' => $small_height, 'span2' => 'large-3 small-6'); } if ($grid == '10') { $g_total = '5'; $g = array('height1' => $tall_height, 'span1' => 'large-6 small-12', 'height2' => $smallest_height, 'span2' => 'large-6 small-12', 'height3' => $smallest_height, 'span3' => 'large-3 small-12', 'height4' => $smallest_height, 'span4' => 'large-3 small-12', 'height5' => $smallest_height, 'span5' => 'large-6 small-12'); } if ($grid == '11') { $g_total = '5'; $g = array('height1' => $less_tall_height, 'span1' => 'large-6 small-12', 'height2' => $less_tall_height, 'span2' => 'large-3 small-12', 'height3' => $tall_height, 'span3' => 'large-3 small-12', 'height4' => $smallest_height, 'span4' => 'large-3 small-12', 'height5' => $smallest_height, 'span5' => 'large-6 small-12'); } if ($grid == '12') { $g_total = '6'; $g = array('height1' => $smallest_height, 'span1' => 'large-8 small-12', 'height2' => $smallest_height, 'span2' => 'large-4 small-12', 'height3' => $smallest_height, 'span3' => 'large-4 small-12', 'height4' => $smallest_height, 'span4' => 'large-8 small-12', 'height5' => $smallest_height, 'span5' => 'large-8 small-12', 'height6' => $smallest_height, 'span6' => 'large-4 small-12'); } if ($grid == '13') { $g_total = '6'; $g = array('height1' => $less_tall_height, 'span1' => 'large-6 small-12', 'height2' => $small_height, 'span2' => 'large-3 small-12', 'height3' => $tall_height, 'span3' => 'large-3 small-12', 'height4' => $smallest_height, 'span4' => 'large-6 small-12', 'height5' => $small_height, 'span5' => 'large-3 small-12', 'height6' => $smallest_height, 'span6' => 'large-6 small-12'); } if ($grid == '14') { $g_total = '6'; $g = array('height1' => $smallest_height, 'span1' => 'large-9 small-12', 'height2' => $tall_height, 'span2' => 'large-3 small-12', 'height3' => $less_tall_height, 'span3' => 'large-3 small-12', 'height4' => $smallest_height, 'span4' => 'large-3 small-12', 'height5' => $smallest_height, 'span5' => 'large-3 small-12', 'height6' => $smallest_height, 'span6' => 'large-6 small-12'); } ob_start(); ?> <?php if ($padding) { $padding_w = $padding / 2; ?> <style> #banner_grid_<?php echo $bannergridID; ?> .ux_banner-grid{margin-left: -<?php echo $padding_w; ?> px !important; margin-right: -<?php echo $padding_w; ?> px !important;} #banner_grid_<?php echo $bannergridID; ?> .ux_banner-grid .columns{margin-bottom: <?php echo $padding; ?> !important} #banner_grid_<?php echo $bannergridID; ?> .ux_banner-grid .columns > .column-inner{padding-left: <?php echo $padding_w; ?> px !important; padding-right: <?php echo $padding_w; ?> px !important;} </style> <?php } ?> <div id="banner_grid_<?php echo $bannergridID; ?> "> <div class="row"> <div class="large-12 columns"> <div class="row collapse ux_banner-grid ux_banner-grid-new"> <?php /** * Check if WooCommerce is active **/ if (function_exists('wc_print_notices')) { ?> <?php if ($product_categories) { foreach ($product_categories as $category) { global $woocommerce_loop; // Store loop count we're currently on if (empty($woocommerce_loop['loop'])) { $woocommerce_loop['loop'] = 0; } // Increase loop count $woocommerce_loop['loop']++; if ($woocommerce_loop['loop'] < $g_total) { $cat_span = $g['span' . $woocommerce_loop['loop']]; $cat_height = $g['height' . $woocommerce_loop['loop']]; } else { $cat_span = $g['span' . $g_total]; $cat_height = $g['height' . $g_total]; } $idcat = $category->woocommerce_term_id; $thumbnail_id = get_woocommerce_term_meta($idcat, 'thumbnail_id', true); $image = wp_get_attachment_image_src($thumbnail_id, 'large'); $image = $image[0]; if ($category->count > 0) { $cat_count = apply_filters('woocommerce_subcategory_count_html', ' <span class="count">' . $category->count . ' ' . __('Products', 'woocommerce') . '</span>', $category); } $cat_link = get_term_link($category->slug, 'product_cat'); ?> <div class="columns ux-grid-column <?php echo $cat_span; ?> " style="height:<?php echo $cat_height; ?> "> <div class="column-inner cat-banner"> <?php echo fixShortcode(' [ux_banner bg_overlay="' . $bg_overlay . '" link="' . $cat_link . '" hover="fade" text_color="light" bg="' . $image . '" tx_color="dark" animate="none" tx_width="60%"] <h2 class="uppercase cat-title">' . $category->name . '</h2><p class="cat-count hide-for-small lead uppercase">' . $cat_count . '</p> [/ux_banner]'); ?> </div><!-- .column-inner --> </div><!-- .columns --> <?php } } woocommerce_reset_loop(); ?> <?php } ?> </div> </div> </div> <script> jQuery(document).ready(function ($) { var $container = $("#banner_grid_<?php echo $bannergridID; ?> .ux_banner-grid"); $container.packery({ itemSelector: ".columns", gutter: 0 }); }); </script> </div><!-- #grid --> <?php $content = ob_get_contents(); ob_end_clean(); return $content; }
function shortcode_ux_slider($atts, $content = null) { $sliderrandomid = rand(); ob_start(); extract(shortcode_atts(array('timer' => '5000', 'bullets' => 'true', 'auto_slide' => 'true', 'arrows' => 'true', 'hide_nav' => 'true', 'nav_color' => '', 'infinitive' => 'true', 'columns' => '', 'height' => '', 'top_padding' => '', 'mobile' => ''), $atts)); ?> <div class="ux_slider_wrapper"> <div id="slider_<?php echo $sliderrandomid; ?> " class="iosSlider default <?php if ($mobile == "false") { echo 'slider-hide-for-small'; } ?> " style="<?php if ($height) { echo 'min-height:' . $height . '; height:' . $height; } ?> "> <div class="slider <?php if ($columns) { echo 'columns-' . $columns; } ?> <?php if ($mobile == "false") { echo 'hide-for-small'; } ?> "> <?php echo fixShortcode($content); ?> </div> <div class="sliderControlls <?php if (!$mobile) { echo 'hide-for-small'; } ?> <?php echo $nav_color; ?> <?php if ($hide_nav == 'false') { echo 'dont_hide_nav'; } ?> "> <?php if ($arrows == 'true') { ?> <div class="sliderNav hide-for-small"> <a href="javascript:void(0)" class="nextSlide next_<?php echo $sliderrandomid; ?> "><span class="icon-angle-left"></span></a> <a href="javascript:void(0)" class="prevSlide prev_<?php echo $sliderrandomid; ?> "><span class="icon-angle-right"></span></a> </div> <?php } ?> <div class="sliderBullets"></div> </div><!-- .sliderControlls --> <div class="ux-loading dark"><i></i><i></i><i></i><i></i></div> </div><!-- #slider --> <script type="text/javascript"> jQuery(document).ready(function($) { // Remove breakes $('.slider > br').remove(); // Remove empty sliders if ($('.slider > p').is(':empty')) { $('.slider > p').remove(); } /* install slider */ $('#slider_<?php echo $sliderrandomid; ?> ').iosSlider({ snapToChildren: true, desktopClickDrag: true, snapFrictionCoefficient: 0.8, autoSlideTransTimer: 500, horizontalSlideLockThreshold:3, slideStartVelocityThreshold:3, infiniteSlider:<?php echo $infinitive; ?> , autoSlide: <?php echo $auto_slide; ?> , autoSlideTimer: <?php echo $timer; ?> , navPrevSelector: $('.next_<?php echo $sliderrandomid; ?> '), navNextSelector: $('.prev_<?php echo $sliderrandomid; ?> '), onSliderLoaded: startSlider, onSlideChange: slideChange, onSliderResize: slideResize, }); function slideChange(args) { $(args.sliderContainerObject).find('.inner-wrap').each(function(){ $(this).removeClass($(this).attr('data-animate')); }); $(args.sliderContainerObject).find('.scroll-animate').each(function(){ $(this).removeClass($(this).attr('data-animate')).removeClass('animated'); }); /* start text animation */ $(args.currentSlideObject).find('.inner-wrap').addClass($(args.currentSlideObject).find('.inner-wrap').attr('data-animate')); $(args.currentSlideObject).find('.scroll-animate').each(function(){ $(this).addClass('animated').addClass($(this).attr('data-animate')); }); /* change slider height */ var slide_height = $(args.currentSlideObject).outerHeight(); $(args.sliderContainerObject).css('min-height',slide_height); $(args.sliderContainerObject).css('height','auto'); /* add current class to slide */ $(args.sliderContainerObject).find('.current').removeClass('current'); $(args.currentSlideObject).addClass('current'); /* update bullets */ $(args.sliderContainerObject).find('.sliderBullets .bullet').removeClass('active'); $(args.sliderContainerObject).find('.sliderBullets .bullet:eq(' + (args.currentSlideNumber - 1) + ')').addClass('active'); } function slideResize(args) { /* set height of first slide */ setTimeout(function(){ var slide_height = $(args.currentSlideObject).outerHeight(); $(args.sliderContainerObject).css('min-height',slide_height); $(args.sliderContainerObject).css('height','auto'); },300); } function startSlider(args){ /* remove spinner when slider is loaded */ $(args.sliderContainerObject).find('.ux-loading').fadeOut(); /* add current class to first slide */ $(args.currentSlideObject).addClass('current'); /* add parallax class if contains paralaxx slides */ $(args.sliderContainerObject).find('.ux_parallax').parent().parent().parent().addClass('parallax_slider'); /* animate first slide */ $(args.currentSlideObject).find('.inner-wrap').addClass($(args.currentSlideObject).find('.inner-wrap').attr('data-animate')); $(args.currentSlideObject).find('.scroll-animate').each(function(){ $(this).addClass('animated').addClass($(this).attr('data-animate')); }); /* set height of first slide */ var slide_height = $(args.currentSlideObject).outerHeight(); $(args.sliderContainerObject).css('min-height',slide_height); $(args.sliderContainerObject).css('height','auto'); if(slide_height < '100') $(args.sliderContainerObject).toggleClass('small-slider'); /* fix texts */ $(args.sliderContainerObject).find('.ux_banner .inner br').remove(); <?php if ($bullets == 'true') { ?> /* add slider bullets */ var slide_id = 1; $(args.sliderContainerObject).find(".slider > *").each(function(){ $(args.sliderContainerObject).find('.sliderBullets').append('<div class="bullet" data-slide="'+slide_id+'"></div>'); slide_id++; }); /* add current class to bullets */ $(args.sliderContainerObject).find('.sliderBullets .bullet:first').addClass('active'); /* make bullets clickable */ $(args.sliderContainerObject).find('.bullet').click(function(){ $(args.sliderContainerObject).iosSlider('goToSlide', $(this).data('slide')); }); <?php } ?> } }); </script> <?php if ($top_padding) { ?> <style>#slider_<?php echo $sliderrandomid; ?> .ux-section-content > .row, #slider_<?php echo $sliderrandomid; ?> .ux_banner .row{margin-top: <?php echo $top_padding; ?> }</style><?php } ?> </div><!-- .ux_slider_wrapper --> <?php $content = ob_get_contents(); ob_end_clean(); return $content; }
?> </div> </body> <?php } else { ?> <body class="antialiased"> <div id="wrapper" class="content-area" style="height:1px;"> <div class="ux_block"> <?php while (have_posts()) { the_post(); ?> <?php echo fixShortcode(get_the_content()); ?> <?php if (current_user_can('edit_posts')) { $edit_link = get_edit_post_link($post->ID); echo '<a class="edit-link" target="_blank" href="' . $edit_link . '">Edit Block</a>'; } ?> <?php } // end of the loop. ?> </div> </div><!-- #content --> </div><!-- #primary --> <?php
function shortcode_ux_slider($atts, $content = null) { extract(shortcode_atts(array('timer' => '6000', 'bullets' => 'true', 'auto_slide' => 'true', 'slide_align' => 'center', 'arrows' => 'circle', 'style' => 'normal', 'nav_pos' => 'inside', 'nav_color' => 'light', 'infinitive' => 'true', 'freescroll' => 'false', 'margin' => '', 'padding' => '', 'columns' => '1', 'friction' => '0.6', 'selectedattraction' => '0.1', 'height' => '', 'rtl' => 'false', 'draggable' => 'true', 'mobile' => 'true'), $atts)); ob_start(); $slider_classes = ''; if ($mobile !== 'true') { $slider_classes = 'hide-for-small'; } if (is_rtl()) { $rtl = 'true'; } if ($auto_slide == 'true') { $auto_slide = $timer; } // Slider Nav visebility $is_arrows = 'true'; $is_bullets = 'true'; if ($arrows == 'false') { $is_arrows = 'false'; } if ($arrows == 'true') { $arrows = 'circle'; } if ($bullets == 'false') { $is_bullets = 'false'; } $css = ''; // Custom CSS if ($margin) { $css = 'margin-bottom:' . $margin . '!important'; } ?> <div class="ux-slider-wrapper relative"> <div class="ux-slider iosSlider <?php echo $slider_classes; ?> slider-style-<?php echo $style; ?> slider-nav-<?php echo $nav_color; ?> slider-nav-<?php echo $nav_pos; ?> slider-nav-<?php echo $arrows; ?> js-flickity" 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; ?> , "prevNextButtons": <?php echo $is_arrows; ?> , "contain" : true, "percentPosition": true, "pageDots": <?php echo $is_bullets; ?> , "selectedAttraction" : <?php echo $selectedattraction; ?> , "friction": <?php echo $friction; ?> , "rightToLeft": <?php echo $rtl; ?> , "draggable": <?php echo $draggable; ?> }' style="<?php echo $css; ?> " > <?php echo fixShortcode($content); ?> </div> <div class="ux-loading dark"></div> </div><!-- .ux-slider-wrapper --> <?php $content = ob_get_contents(); ob_end_clean(); return $content; }