Example #1
0
function portfolioYTShortcode($atts, $content = null)
{
    $atts = ytshortcode_atts(array('style' => 1, 'source' => '', 'limit' => 15, 'color' => '#cccccc', 'intro_text_limit' => 50, 'grid_type' => 0, 'animation' => 'fade', 'speed' => 600, 'rotate' => 99, 'delay' => 20, 'border' => 0, 'padding' => 10, 'thumb_width' => 640, 'thumb_height' => 480, 'class' => ''), $atts, 'portfolio');
    $return = '';
    $slides = (array) get_slides($atts);
    $intro_text = '';
    $title = '';
    if (count($slides)) {
        $id = uniqid('ytpor_') . rand() . time();
        $return .= '<script>jQuery(document).ready(function($) {
				$(\'#' . $id . ' .megafolio-container\').each(function () {
					data = $(this).data();

					var api=$(this).megafoliopro({
							filterChangeAnimation: data.animation,	// fade, rotate, scale, rotatescale, pagetop, pagebottom,pagemiddle
							filterChangeSpeed: data.speed,			// Speed of Transition
							filterChangeRotate:data.rotate,			// If you ue scalerotate or rotate you can set the rotation (99 = random !!)
							filterChangeScale:0.6,			// Scale Animation Endparameter
							delay: data.delay,
							defaultWidth:980,
							paddingHorizontal:data.padding,
							paddingVertical:data.padding,
							layoutarray:[data.grid_types]		// Defines the Layout Types which can be used in the Gallery. 2-9 or "random". You can define more than one, like {5,2,6,4} where the first items will be orderd in layout 5, the next comming items in layout 2, the next comming items in layout 6 etc... You can use also simple {9} then all item ordered in Layout 9 type.
						});

					// CALL FILTER FUNCTION IF ANY FILTER HAS BEEN CLICKED
					$(\'#' . $id . ' .filter\').click(function() {
						$(\'#' . $id . ' .filter\').each(function() { $(this).removeClass("selected")});
						api.megafilter($(this).data(\'category\'));
						$(this).addClass("selected");
					});

					// Lightbox for galleries (slider, carousel, custom_gallery)
					$(this).find(\'.yt-lightbox-item\').magnificPopup({
						type: \'image\',
						mainClass: \'mfp-zoom-in mfp-img-mobile\',
						closeBtnInside: false,
						tLoading: \'\', // remove text from preloader
						removalDelay: 400, //delay removal by X to allow out-animation
						gallery: {
							enabled: true,
							navigateByImgClick: true,
							preload: [0, 1] // Will preload 0 - before current, and 1 after the current image
						},
						callbacks: {
							open: function() {

								//overwrite default prev + next function. Add timeout for css3 crossfade animation
								$.magnificPopup.instance.next = function() {
									var self = this;
									self.wrap.removeClass(\'mfp-image-loaded\');
									setTimeout(function() { $.magnificPopup.proto.next.call(self); }, 120);
								}
								$.magnificPopup.instance.prev = function() {
									var self = this;
									self.wrap.removeClass(\'mfp-image-loaded\');
									setTimeout(function() { $.magnificPopup.proto.prev.call(self); }, 120);
								}
							},
							imageLoadComplete: function() {
								var self = this;
								setTimeout(function() { self.wrap.addClass(\'mfp-image-loaded\'); }, 16);
							}
						}
					});	
				});
			});
			</script>';
        $return .= '<div id="' . $id . '" class="yt-portfolio sup-style' . $atts['style'] . ' ' . $atts['class'] . '" >
                <div class="filter_padder" >
                    <div class="filter_wrapper">
                        <div class="filter selected" data-category="cat-all">All</div>';
        $category = array();
        foreach ((array) $slides as $slide) {
            if (in_array($slide['category'], $category)) {
                continue;
            }
            $category[] = $slide['category'];
            $return .= '<div class="filter" data-category="' . str_replace(' ', '-', strtolower($slide['category'])) . '">' . $slide['category'] . '</div>';
        }
        $return .= '
                        <div class="clear"></div>
                    </div>
                </div>
                <div class="clear"></div>
            <div class="megafolio-container"
                data-grid_types="' . $atts['grid_type'] . '"
                data-speed="' . $atts['speed'] . '"
                data-delay="' . $atts['delay'] . '"
                data-rotate="' . $atts['rotate'] . '"
                data-padding="' . intval($atts['padding']) . '"
                data-animation="' . $atts['animation'] . '" >';
        $limit = 1;
        foreach ((array) $slides as $slide) {
            $thumb_url = yt_image_resize($slide['image'], $atts['thumb_width'], $atts['thumb_height'], 95);
            // Title condition
            if ($slide['title']) {
                $title = stripslashes($slide['title']);
            }
            if (isset($slide['introtext'])) {
                $intro_text = $slide['introtext'];
                if ($atts['intro_text_limit']) {
                    $atts['intro_text'] = yt_char_limit($intro_text, $atts['intro_text_limit']);
                }
            }
            $category = str_replace(' ', '-', strtolower($slide['category']));
            if ($atts['style'] == 2) {
                $return .= '
                            <div class="mega-entry cat-all ' . $category . '" data-src="' . yt_image_media($thumb_url['url']) . '" data-width="500" data-height="500">
                                <div class="links-container">
                                    <a class="hoverlink project-link" href="' . $slide['link'] . '" title="' . strip_tags($title) . '">
                                        <i class=" fa fa-link"></i>
                                        <span></span>
                                    </a>
                                    <a class="hoverlink yt-lightbox-item" href="' . yt_image_media($slide['image']) . '" title="' . strip_tags($title) . '">
                                        <i class=" fa fa-search"></i>
                                        <span></span>
                                    </a>
                                </div>
                                <div class="rollover-content mega-covercaption mega-square-bottom mega-portrait-bottom">

                                    <div class="rollover-content-container">
                                        <h3 class="entry-title">' . $title . '</h3>

                                        <div class="entry-meta">
                                            <div class="yt-portfolio-date">
                                                <span class="yt-pdate">' . JHTML::_('date', $slide['created'], JText::_('DATE_FORMAT_LC3')) . '</span>
                                            </div>
                                            <div class="portfolio-categories">
                                                <span class="category">' . $category . '</span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>';
            } elseif ($atts['style'] == 3) {
                $return .= '
                        <div class="mega-entry cat-all ' . $category . '" data-src="' . yt_image_media($thumb_url['url']) . '" data-width="500" data-height="500">
                            <div class="mega-hover notitle">
                                <a class="yt-lightbox-item" href="' . yt_image_media($slide['image']) . '" title="' . strip_tags($title) . '">
                                    <div class="mega-hoverview fa fa-search"></div>
                                </a>
                                <a class="hoverlink project-link" href="' . $slide['link'] . '" title="' . strip_tags($title) . '">
                                    <i class="mega-hoverlink fa fa-link"></i>
                                </a>
                            </div>

                            <div class="gallerycaption-bottom">
                                ' . $title . '
                                <div class="gallerysubline">' . $category . '</div>
                            </div>
                        </div>';
            } elseif ($atts['style'] == 4) {
                $return .= '
                        <div class="mega-entry portfolio-style4 cat-all ' . $category . '" data-src="' . yt_image_media($thumb_url['url']) . '" data-width="500" data-height="500">

                            <div class="portfolio-links">
                                <a class="yt-lightbox-item" href="' . yt_image_media($slide['image']) . '" title="' . strip_tags($title) . '">
                                    <i class="fa fa-search"></i>
                                </a>
                                <a class="portfolio-link" href="' . $slide['link'] . '" title="' . strip_tags($title) . '">
                                    <i class="fa fa-link"></i>
                                </a>
                            </div>
                            <div class="portfolio-content">
                                <div class="portfolio-title">' . $title . '</div>
                                <div class="portfolio-desc">' . $atts['intro_text'] . '</div>
                            </div>
                        </div>';
            } else {
                $return .= '
                        <div class="mega-entry cat-all ' . $category . '" data-src="' . yt_image_media($thumb_url['url']) . '" data-width="500" data-height="500">
                            <div class="mega-hover">
                                <div class="mega-hovertitle">' . $title . '
                                    <div class="mega-hoversubtitle">' . $atts['intro_text'] . '</div>
                                </div>
                                <a href="' . $slide['link'] . '" title="' . strip_tags($title) . '">
                                    <i class="mega-hoverlink fa fa-link"></i>
                                </a>
                                <a class="yt-lightbox-item" href="' . yt_image_media($slide['image']) . '" title="' . strip_tags($title) . '">
                                    <i class="mega-hoverview fa fa-search"></i>
                                </a>
                            </div>
                        </div>';
            }
            if ($limit++ == $atts['limit']) {
                break;
            }
        }
        $return .= '</div></div>';
        $css = '
              #' . $id . ' .mega-hoversubtitle { color: ' . $atts['color'] . ';}
              #' . $id . ' .mega-entry .mega-entry-innerwrap { border: ' . $atts['border'] . ';}
            ';
        JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/portfolio/css/portfolio.css", 'text/css', "screen");
        JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/assets/css/magnific-popup.css", 'text/css', "screen");
        JHtml::_('jquery.framework');
        JHtml::script(JUri::base() . "plugins/system/ytshortcodes/assets/js/magnific-popup.js");
        JHtml::script(JUri::base() . "plugins/system/ytshortcodes/shortcodes/portfolio/js/themepunch_tools.js");
        JHtml::script(JUri::base() . "plugins/system/ytshortcodes/shortcodes/portfolio/js/themepunch_megafoliopro.js");
        $doc = JFactory::getDocument();
        $doc->addStyleDeclaration($css);
    } else {
        $return = yt_alert_box('Please select your correct article source.', 'warning');
    }
    return $return;
}
Example #2
0
    <!--[if lt IE 9]>
   		<script type="text/javascript" src="<?php 
bloginfo('template_url');
?>
/js/html5.js"></script>
        <link rel="stylesheet" href="<?php 
bloginfo('template_url');
?>
/css/ie.css" type="text/css" media="screen">
	<![endif]-->
    <?php 
wp_head();
?>
</head>
<?php 
$slides = get_slides();
if (is_page()) {
    $content = $slides[0];
    $key = 2;
} elseif (is_category()) {
    $content = $slides[1];
    $key = 3;
} elseif (is_single()) {
    $content = $slides[2];
    $key = 4;
} else {
    $content = $slides[0];
    $key = 2;
}
?>
<body id="page<?php 
Example #3
0
function carouselYTShortcode($atts, $content = null)
{
    $return = '';
    $atts = ytshortcode_atts(array('style' => '1', 'source' => '', 'limit' => 5, 'items' => 4, 'image' => 'yes', 'quality' => 95, 'title' => 'yes', 'title_link' => 'yes', 'title_limit' => '', 'intro_text' => 'yes', 'intro_text_limit' => '60', 'background' => '', 'color' => '', 'title_color' => '', 'date' => 'no', 'category' => 'no', 'image_width' => 360, 'image_height' => 320, 'margin' => 10, 'scroll' => 1, 'arrows' => 'no', 'arrow_position' => 'default', 'pagination' => 'yes', 'autoplay' => 'no', 'delay' => 4, 'speed' => 0.35, 'hoverpause' => 'no', 'lazyload' => 'no', 'loop' => 'yes', 'class' => ''), $atts, 'yt_carousel');
    $id = uniqid('ytc') . rand() . time();
    $title = "";
    $image = "";
    $intro_text = '';
    $css = '';
    $background = '';
    $color = '';
    $lang = JFactory::getLanguage();
    $lang = $lang->isRTL() ? 'true' : 'false';
    $slides = (array) get_slides($atts);
    if ($atts['background'] or $atts['color']) {
        $background = $atts['background'] ? 'background-color:' . $atts['background'] . ';' : '';
        $color = $atts['color'] ? 'color:' . $atts['color'] . ';' : '';
        $css .= '.' . $id . ' .yt-carousel-slide {' . $background . $color . '}';
        if ($atts['style'] == 3) {
            $css .= '.' . $id . '.yt-carousel-style-3 .yt-carousel-caption:after {border-bottom-color: ' . $atts['background'] . ';}';
        }
    }
    if ($atts['title_color']) {
        $css .= '.' . $id . '.yt-carousel-slide .yt-carousel-slide-title a {color: ' . $atts['title_color'] . ';}';
        $css .= '.' . $id . '.yt-carousel-slide .yt-carousel-slide-title a:hover {color: ' . yt_lighten($atts['title_color'], '10%') . ';}';
    }
    if (count($slides) and ($atts['title'] == 'yes' or $atts['image'] == 'yes' or $atts['intro_text'] === 'yes')) {
        $source = substr($atts['source'], 0, 5);
        if ($source == 'media') {
            $atts['class'] .= ' yt-carousel-media';
        }
        $return .= '<div id="' . $id . '" class="yt-clearfix ' . $id . ' ' . $atts['class'] . ' yt-carousel yt-carousel-style-' . $atts['style'] . ' yt-carousel-title-' . $atts['title'] . ' arrow-' . $atts['arrow_position'] . '" data-autoplay="' . $atts['autoplay'] . '" data-delay="' . $atts['delay'] . '" data-speed="' . $atts['speed'] . '" data-arrows="' . $atts['arrows'] . '" data-pagination="' . $atts['pagination'] . '" data-lazyload="' . $atts['lazyload'] . '" data-hoverpause="' . $atts['hoverpause'] . '" data-items="' . $atts['items'] . '" data-margin="' . $atts['margin'] . '" data-scroll="' . $atts['scroll'] . '" data-loop="' . $atts['loop'] . '" data-rtl="' . $lang . '"  ><div class="' . $id . ' yt-carousel-slides">';
        $limit = 1;
        foreach ((array) $slides as $slide) {
            $image_url = '';
            if ($slide['image']) {
                $image_url = yt_image_resize($slide['image'], $atts['image_width'], $atts['image_height'], $atts['quality']);
            } else {
                $image_url = yt_image_resize('plugins/system/ytshortcodes/assets/images/URL_IMAGES.png', $atts['image_width'], $atts['image_height'], $atts['quality']);
            }
            if ($atts['title'] == 'yes' && $slide['title']) {
                $title = stripslashes($slide['title']);
                if ($atts['title_limit']) {
                    $title = yt_char_limit($title, $atts['title_limit']);
                }
                if ($atts['title_link'] == "yes") {
                    $title = '<a href="' . $slide['link'] . '">' . $title . '</a>';
                }
                $title = '<h3 class="yt-carousel-slide-title">' . $title . '</h3>';
            }
            if ($atts['intro_text'] === 'yes' and isset($slide['introtext'])) {
                $intro_text = $slide['introtext'];
                if ($atts['intro_text_limit']) {
                    $intro_text = yt_char_limit($intro_text, $atts['intro_text_limit']);
                }
                $intro_text = '<div class="yt-carousel-item-text">' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $intro_text)) . '</div>';
            }
            $return .= '<div class="' . $id . ' yt-carousel-slide">';
            if (isset($image_url) && $atts['image'] == 'yes') {
                $return .= '<div class="yt-carousel-image">';
                if (isset($image_url)) {
                    $return .= '<div class="yt-carousel-links">
                                <a class="yt-lightbox-item" href="' . yt_image_media($slide['image']) . '" title="' . strip_tags($title) . '">
                                    <i class="fa fa-search"></i>
                                </a>';
                    if ($source != 'media') {
                        $return .= '<a class="yt-carousel-link" href="' . $slide['link'] . '" title="' . strip_tags($title) . '">
                                        <i class="fa fa-link"></i>
                                    </a>';
                    }
                    $return .= '</div>';
                }
                $return .= '<img src="' . yt_image_media($image_url['url']) . '" alt="' . strip_tags($title) . '" />';
                $return .= '</div>';
            }
            if ($title or $intro_text) {
                $return .= '<div class="yt-carousel-caption">' . $title . $intro_text . '</div>';
            }
            $return .= '</div>';
            if ($limit++ == $atts['limit']) {
                break;
            }
        }
        $return .= '</div>';
        JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/assets/css/magnific-popup.css", 'text/css', "screen");
        JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/assets/css/owl.carousel.css", 'text/css', "screen");
        JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/carousel/css/carousel.css");
        JHtml::_('jquery.framework');
        JHtml::script(JUri::base() . "plugins/system/ytshortcodes/assets/js/magnific-popup.js");
        JHtml::script(JUri::base() . "plugins/system/ytshortcodes/assets/js/owl.carousel.min.js");
        $return .= '</div>';
        $doc = JFactory::getDocument();
        $doc->addStyleDeclaration($css);
        $doc->addScriptDeclaration('
		    jQuery(document).ready(function ($) {
				// Enable carousels
					jQuery(\'.' . $id . '.yt-carousel\').each(function () {
						// Prepare data
						var $carousel = $(this),
							$slides = $(\'.' . $id . '.yt-carousel-slides\'),
							$slide = $(\'.' . $id . '.yt-carousel-slide\'),
							data = $carousel.data();
						// Apply Swiper
						var $owlCarousel = $slides.owlCarousel({
							responsiveClass: true,
							mouseDrag: true,
							autoplayTimeout: data.delay * 1000,
							smartSpeed: data.speed * 1000,
							lazyLoad: (data.lazyload == \'yes\') ? true : false,
							autoplay: (data.autoplay == \'yes\') ? true : false,
							autoplayHoverPause: (data.hoverpause == \'yes\') ? true : false,
							center: (data.center == \'yes\') ? true : false,
							loop: (data.loop == \'yes\') ? true : false,
							margin: data.margin,
							navText: [\'\',\'\'],
							rtl: data.rtl,
							responsive:{
						        0:{
						            items:1,
						            margin: 0,
						            dots: (data.pagination == \'yes\') ? true : false,
				            		nav: (data.arrows == \'yes\') ? true : false
						        },
						        768:{
						            items:$carousel.data(\'items\'),
						            dots: (data.pagination == \'yes\') ? true : false,
				            		nav: (data.arrows == \'yes\') ? true : false
						        },
						        1000:{
						            items: $carousel.data(\'items\'),
						            dots: (data.pagination == \'yes\') ? true : false,
				            		nav: (data.arrows == \'yes\') ? true : false
						        }
						    }
						});

						// Lightbox for galleries (slider, carousel, custom_gallery)
						$(this).find(\'.yt-lightbox-item\').magnificPopup({
							type: \'image\',
							mainClass: \'mfp-zoom-in mfp-img-mobile\',
							tLoading: \'\', // remove text from preloader
							removalDelay: 400, //delay removal by X to allow out-animation
							gallery: {
								enabled: true,
								navigateByImgClick: true,
								preload: [0, 1] // Will preload 0 - before current, and 1 after the current image
							},
							callbacks: {
								open: function() {
									//overwrite default prev + next function. Add timeout for css3 crossfade animation
									$.magnificPopup.instance.next = function() {
										var self = this;
										self.wrap.removeClass(\'mfp-image-loaded\');
										setTimeout(function() { $.magnificPopup.proto.next.call(self); }, 120);
									}
									$.magnificPopup.instance.prev = function() {
										var self = this;
										self.wrap.removeClass(\'mfp-image-loaded\');
										setTimeout(function() { $.magnificPopup.proto.prev.call(self); }, 120);
									}
								},
								imageLoadComplete: function() {
									var self = this;
									setTimeout(function() { self.wrap.addClass(\'mfp-image-loaded\'); }, 16);
								}
							}
						});

					});
				});
		');
    } else {
        $return = yt_alert_box('Carousel content not found, please check carousel source settings.', 'warning');
    }
    return $return;
}
Example #4
0
function ShowcaseYTShortcode($atts = null, $content = null)
{
    $atts = ytshortcode_atts(array('source' => '', 'limit' => 12, 'loading_animation' => 'default', 'filter_animation' => 'rotateSides', 'caption_style' => 'overlayBottomPush', 'horizontal_gap' => 10, 'vertical_gap' => 10, 'filter' => 'yes', 'filter_deeplink' => 'no', 'page_deeplink' => 'no', 'popup_position' => 'below', 'popup_category' => 'yes', 'popup_date' => 'yes', 'popup_image' => 'yes', 'large' => 4, 'medium' => 3, 'small' => 1, 'thumb_width' => 640, 'thumb_height' => 480, 'class' => ''), $atts, 'showcase');
    $slides = (array) get_slides($atts);
    $id = uniqid('ytsc') . rand() . time();
    $intro_text = '';
    $title = '';
    $return = '';
    $atts['filter_deeplink'] = $atts['filter_deeplink'] === 'yes' ? 'true' : 'false';
    $atts['page_deeplink'] = $atts['page_deeplink'] === 'yes' ? 'true' : 'false';
    if (count($slides)) {
        $return .= '<div id="' . $id . '" class="yt-showcase" data-scid="' . $id . '" data-loading_animation="' . $atts['loading_animation'] . '" data-filter_animation="' . $atts['filter_animation'] . '" data-caption_style="' . $atts['caption_style'] . '" data-horizontal_gap="' . intval($atts['horizontal_gap']) . '" data-vertical_gap="' . intval($atts['vertical_gap']) . '" data-popup_position="' . $atts['popup_position'] . '" data-large="' . $atts['large'] . '" data-medium="' . $atts['medium'] . '" data-small="' . $atts['small'] . '" data-filter_deeplink="' . $atts['filter_deeplink'] . '" data-page_deeplink="' . $atts['page_deeplink'] . '" >';
        if ($atts['filter'] !== 'no') {
            $return .= '<div id="' . $id . '_filter" class="cbp-l-filters-dropdown">
                            <div class="cbp-l-filters-dropdownWrap">
                                <div class="cbp-l-filters-dropdownHeader">Sort Showcase</div>
                                <div class="cbp-l-filters-dropdownList">
                                    <div data-filter="*" class="cbp-filter-item-active cbp-filter-item">
                                        All Items (<div class="cbp-filter-counter"></div> items)
                                    </div>';
            $category = array();
            foreach ((array) $slides as $slide) {
                if (in_array($slide['category'], $category)) {
                    continue;
                }
                $category[] = $slide['category'];
                $return .= '<div class="cbp-filter-item" data-filter=".' . str_replace(' ', '-', strtolower($slide['category'])) . '">' . $slide['category'] . ' (<div class="cbp-filter-counter"></div> items)</div>';
            }
            $return .= '</div>
                            </div>
                        </div>';
        }
        $return .= '<div id="' . $id . '_container" class="cbp-l-grid-gallery">';
        $limit = 1;
        foreach ((array) $slides as $slide) {
            $thumb_url = yt_image_resize($slide['image'], $atts['thumb_width'], $atts['thumb_height'], 95);
            // Title condition
            if ($slide['title']) {
                $title = stripslashes($slide['title']);
            }
            $category = str_replace(' ', '-', strtolower($slide['category']));
            $itemid = uniqid() . rand() . time();
            $return .= '
                    <div class="cbp-item ' . $category . ' motion">
                         <a href="' . $slide['link'] . '" class="cbp-caption cbp-singlePageInline"
                           data-title="' . $title . ' // ' . $slide['category'] . '">
                            <div class="cbp-caption-defaultWrap">';
            if ($slide['image']) {
                $return .= '<img src="' . yt_image_media($thumb_url['url']) . '" alt="' . $title . '">';
            } else {
                $return .= '<img src="' . yt_image_media(JURI::base() . 'plugins/system/ytshortcodes/assets/images/URL_IMAGES.png') . '" alt="' . $title . '" width="640" height="480" />';
            }
            $return .= '</div>
                            <div class="cbp-caption-activeWrap">
                                <div class="cbp-l-caption-alignLeft">
                                    <div class="cbp-l-caption-body">
                                        <div class="cbp-l-caption-title">' . $title . '</div>
                                        <div class="cbp-l-caption-desc">' . $slide['category'] . '</div>
                                    </div>
                                </div>
                            </div>
                        </a>
                    </div>';
            if ($limit++ == $atts['limit']) {
                break;
            }
        }
        $return .= '</div><div class="clearfix"></div>';
        $return .= '<div id="' . $id . '_inlinecontents" style="display: none;">';
        foreach ((array) $slides as $slide) {
            $date = JHTML::_('date', $slide['created'], JText::_('DATE_FORMAT_LC3'));
            $textImg = yt_all_images($slide['fulltext']);
            $return .= '
                    <div>
                        <div class="cbp-l-inline">
                            <div class="cbp-l-inline-left">';
            if ($atts['popup_image'] === 'yes' and $textImg != null) {
                $return .= '
                                    <div class="cbp-slider">
                                        <ul class="cbp-slider-wrap">
                                            <li class="cbp-slider-item"><img src="' . yt_image_media($slide['image']) . '" alt="' . $slide['title'] . '"></li>';
                foreach ($textImg as $img) {
                    $return .= '<li class="cbp-slider-item"><img src="' . yt_image_media($img) . '" alt="' . $slide['title'] . '"></li>';
                }
                $return .= '</ul>
                                </div>';
            } elseif ($atts['popup_image'] === 'yes') {
                $return .= '<img src="' . yt_image_media($slide['image']) . '" alt="' . $slide['title'] . '">';
            }
            $return .= '</div>
                            <div class="cbp-l-inline-right">
                                <div class="cbp-l-inline-title">' . $slide['title'] . '</div>
                                <div class="cbp-l-inline-subtitle">' . $slide['category'] . ' // ' . $date . '</div>

                                <div class="cbp-l-inline-desc">' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />", "<p>", "</p>"), " ", $slide['introtext'])) . '</div>

                                <a href="' . $slide['link'] . '" class="cbp-l-inline-view">View Details</a>
                            </div>
                        </div>
                    </div>';
        }
        $return .= '</div></div>';
        JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/showcase/css/cubeportfolio.min.css", 'text/css');
        JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/showcase/css/showcase.css", 'text/css');
        JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/assets/css/magnific-popup.css", 'text/css');
        JHtml::script("plugins/system/ytshortcodes/assets/js/magnific-popup.js");
        JHtml::script("plugins/system/ytshortcodes/shortcodes/showcase/js/cubeportfolio.min.js");
        JHtml::script("plugins/system/ytshortcodes/shortcodes/showcase/js/showcase.js");
    } else {
        $return = yt_alert_box('Error: Something wrong there, please check your showcase source.', 'warning');
    }
    return $return;
}
Example #5
0
function Content_styleYTShortcode($atts = null, $content = null)
{
    $atts = ytshortcode_atts(array('type_change' => 'single_column', 'source' => '', 'limit' => 20, 'image' => 'yes', 'title' => 'yes', 'link_title' => 'yes', 'intro_text' => 'yes', 'intro_text_limit' => '', 'date' => 'yes', 'time' => 'yes', 'read_more' => 'no', 'order' => 'created', 'order_by' => 'desc', 'highlight_year' => 'yes', 'icon_bg' => '', 'before_text' => '', 'after_text' => '', 'class' => '', 'gutter' => '', 'sticky_mode' => '', 'masonry_sticky_size' => '', 'masonry_size' => '', 'masonry_sticky_medium_size' => '', 'masonry_medium_size' => '', 'masonry_sticky_small_size' => '', 'masonry_small_size' => '', 'masonry_sticky_extra_small_size' => '', 'masonry_extra_small_size' => '', 'masonry_sticky_width' => '', 'masonry_width' => '', 'grid' => 'no', 'offset' => '', 'column' => '', 'style_slider' => '', 'transitionin' => 'bounceIn', 'transitionout' => 'bounceOut', 'arrows' => 'yes', 'arrow_position' => 'arrow-default', 'pagination' => 'no', 'autoplay' => 'yes', 'autoheight' => 'yes', 'hoverpause' => 'yes'), $atts, 'yt_content_style');
    $blogid = 'cpt_list_' . rand();
    $slides = (array) get_slides($atts);
    $return = '';
    switch ($atts['type_change']) {
        case 'masonry':
            $masonry = '';
            $masonry .= ' [yt_masonry id="' . $blogid . '" gutter="' . $atts['gutter'] . '"] ';
            $limit = 1;
            foreach ($slides as $slide) {
                if ($atts['intro_text_limit']) {
                    $slide['introtext'] = yt_char_limit($slide['introtext'], $atts['intro_text_limit']);
                }
                $title = $slide['title'];
                $masonry .= ' [yt_masonry_item ' . 'size="' . $atts['masonry_sticky_size'] . '" ' . 'medium_size="' . $atts['masonry_sticky_medium_size'] . '" ' . 'small_size="' . $atts['masonry_sticky_small_size'] . '" ' . 'extra_small_size="' . $atts['masonry_sticky_extra_small_size'] . '" ' . 'width="' . $atts['masonry_sticky_width'] . '"]';
                $masonry .= '<div class="yt_content_style_masonry">';
                if ($slide['image'] and $atts['image'] === 'yes') {
                    $masonry .= '<div class=""><img src="' . yt_image_media($slide['image']) . '" alt="" /></div>';
                }
                if ($atts['title'] === 'yes' and isset($slide['title'])) {
                    $masonry .= '<h1>';
                    if ($atts['link_title'] === 'yes') {
                        $masonry .= '<a href="' . $slide['link'] . '">';
                    }
                    $masonry .= $title;
                    if ($atts['link_title'] === 'yes') {
                        $masonry .= '</a>';
                    }
                    $masonry .= '</h1>';
                }
                if ($atts['intro_text'] === 'yes' and isset($slide['introtext'])) {
                    $masonry .= '<div class="yt-masonry-item-text">' . $slide['introtext'] . '</div>';
                }
                $masonry .= '<div style="margin:15px;"> <i class="fa fa-calendar"></i> ' . JHTML::_('date', $slide['created'], JText::_('DATE_FORMAT_LC3')) . ' // <i class="fa fa-book"></i> ' . $slide['category'] . ',' . $slide['category_alias'] . ' // <i class="fa fa-user"></i> by ' . $slide['author_name'] . '. </div>';
                $masonry .= '</div>';
                $masonry .= ' [/yt_masonry_item] ';
                if ($limit++ == $atts['limit']) {
                    break;
                }
            }
            $masonry .= ' [/yt_masonry] ';
            $return .= parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $masonry));
            break;
        case 'timeline':
            if ($atts['before_text']) {
                $return .= '<div class="yt-timeline-before-text"><span>' . $atts['before_text'] . '</span></div>';
            }
            $date = date('Y');
            $return .= '<div class="yt-timeline animated">';
            if (count($slides)) {
                $limit = 1;
                foreach ($slides as $slide) {
                    if ($atts['intro_text_limit']) {
                        $slide['introtext'] = yt_char_limit($slide['introtext'], $atts['intro_text_limit']);
                    }
                    $title = $slide['title'];
                    $icon = $title ? explode('|| fa-', $title) : array();
                    if (count($icon) == 2) {
                        $title = trim($icon[0]);
                        $icon = '<i class="fa fa-' . trim($icon[1]) . '"></i>';
                    } else {
                        $title = $slide['title'];
                        $icon = '<i class="fa fa-circle"></i>';
                    }
                    $has_icon = '';
                    if (isset($icon[1])) {
                        $has_icon = 'has-ta-icon';
                    }
                    $icon_bg = $atts['icon_bg'] ? 'style="background-color:' . $atts['icon_bg'] . ';"' : '';
                    if ($date != JHTML::_('date', $slide['created'], "Y") && $atts['highlight_year'] == 'yes') {
                        $return .= '<div class="yt-timeline-row yt-timeline-has-year">' . "\n";
                        $date = JHTML::_('date', $slide['created'], "Y");
                        $return .= '<div class="yt-timeline-year"><span>' . "\n";
                        $return .= $date . "\n";
                        $return .= '</span></div>' . "\n";
                    } else {
                        $return .= '<div class="yt-timeline-row">' . "\n";
                    }
                    $return .= '<div class="yt-timeline-icon ' . $has_icon . '"><div class="bg-primary" ' . $icon_bg . '>' . $icon . '</div></div>';
                    $return .= '<div class="yt-timeline-time">';
                    if ($atts['date'] == 'yes') {
                        $return .= '<small>' . JHTML::_('date', $slide['created'], JText::_('DATE_FORMAT_LC3')) . '</small>';
                    }
                    if ($atts['time'] == 'yes') {
                        $return .= JHTML::_('date', $slide['created'], "g:i A");
                    }
                    $return .= '</div>';
                    $return .= '<div class="yt-timeline-content">' . "\n";
                    $return .= '<div class="yt-timeline-content-body">' . "\n";
                    if ($atts['title'] === 'yes' and isset($slide['title'])) {
                        $return .= '<h3 class="yt-timeline-item-title">';
                        if ($atts['link_title'] === 'yes') {
                            $return .= '<a href="' . yt_image_media($slide['link']) . '">';
                        }
                        $return .= $title;
                        if ($atts['link_title'] === 'yes') {
                            $return .= '</a>';
                        }
                        $return .= '</h3>';
                    }
                    if ($slide['image'] and $atts['image'] === 'yes') {
                        $return .= '<div class="yt-timeline-item-image"><img src="' . yt_image_media($slide['image']) . '" alt="" /></div>';
                    }
                    if ($atts['intro_text'] === 'yes' and isset($slide['introtext'])) {
                        $return .= '<div class="yt-timeline-item-text">' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $slide['introtext'])) . '</div>';
                    }
                    if ($atts['read_more'] === 'yes') {
                        $return .= '<a class="yt-timeline-readmore readon" href="' . yt_image_media($slide['link']) . '">Read More...</a>';
                    }
                    $return .= '</div>' . "\n";
                    $return .= '</div>' . "\n";
                    $return .= '</div>' . "\n";
                    if ($limit++ == $atts['limit']) {
                        break;
                    }
                }
                $return .= '</div>';
                if ($atts['after_text']) {
                    $return .= '<div class="yt-timeline-after-text"><span>' . $atts['after_text'] . '</span></div><br/>';
                }
                JHtml::_('jquery.framework');
                JHtml::script(JUri::base() . "plugins/system/ytshortcodes/shortcodes/content_style/js/content_style.js");
            } else {
                $return .= yt_alert_box('Timeline not work, Please select the correct source and settings.', 'warning');
            }
            break;
        case 'multiple_column':
            $multiple_column = '';
            $limit = 1;
            $i = 1;
            $multiple_column .= ' [yt_columns grid="' . $atts['grid'] . '"] ';
            foreach ($slides as $slide) {
                if ($atts['intro_text_limit']) {
                    $slide['introtext'] = yt_char_limit($slide['introtext'], $atts['intro_text_limit']);
                }
                $title = $slide['title'];
                $multiple_column .= ' [yt_columns_item offset="' . $atts['offset'] . '" col="' . floor(12 / $atts['column']) . '"] ';
                if ($slide['image']) {
                    $multiple_column .= '<img src="' . yt_image_media($slide['image']) . '" alt="" style="margin-bottom:15px;"/>';
                } else {
                    $multiple_column .= '<img src="' . yt_image_media(JURI::base() . 'plugins/system/ytshortcodes/assets/images/URL_IMAGES.png') . '" alt="" />';
                }
                if ($atts['title'] === 'yes' and isset($slide['title'])) {
                    $multiple_column .= '<h1>';
                    if ($atts['link_title'] === 'yes') {
                        $multiple_column .= '<a href="' . yt_image_media($slide['link']) . '">';
                    }
                    $multiple_column .= $title;
                    if ($atts['link_title'] === 'yes') {
                        $multiple_column .= '</a>';
                    }
                    $multiple_column .= '</h1>';
                }
                if ($atts['date'] == 'yes') {
                    $multiple_column .= '<i class="fa fa-calendar"></i> ' . JHTML::_('date', $slide['created'], JText::_('DATE_FORMAT_LC3')) . ' // <i class="fa fa-book"></i> ' . $slide['category'] . ',' . $slide['category_alias'] . ' // <i class="fa fa-user"></i> by ' . $slide['author_name'] . '.';
                }
                $multiple_column .= '<div class="yt_contentstyle_content">' . $slide['introtext'] . '</div>';
                $multiple_column .= ' [/yt_columns_item] ';
                if ($i++ == $atts['column']) {
                    break;
                }
                if ($limit++ == $atts['limit']) {
                    break;
                }
            }
            $multiple_column .= ' [/yt_columns] ';
            $return = parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $multiple_column));
            break;
        case 'slider':
            $slider = '';
            $limit = 1;
            $slider .= ' [yt_content_slider style="' . $atts['style_slider'] . '" transitionin="' . $atts['transitionin'] . '" transitionout="' . $atts['transitionout'] . '" arrows="' . $atts['arrows'] . '" arrow_position="' . $atts['arrow_position'] . '" pagination="' . $atts['pagination'] . '" autoplay="' . $atts['autoplay'] . '" autoheight="' . $atts['autoheight'] . '" hoverpause="' . $atts['hoverpause'] . '"] ';
            foreach ($slides as $slide) {
                $title = $slide['title'];
                $slider .= ' [yt_content_slider_item] ';
                if ($slide['image']) {
                    $slider .= '<img src="' . yt_image_media($slide['image']) . '" alt="" />';
                } else {
                    $slider .= '<img src="' . yt_image_media(JURI::base() . 'plugins/system/ytshortcodes/assets/images/URL_IMAGES.png') . '" alt="" />';
                }
                $slider .= ' [/yt_content_slider_item] ';
                if ($limit++ == $atts['limit']) {
                    break;
                }
            }
            $slider .= ' [/yt_content_slider] ';
            $return = parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $slider));
            break;
        default:
            $single_column = '';
            $limit = 1;
            foreach ($slides as $slide) {
                if ($atts['intro_text_limit']) {
                    $slide['introtext'] = yt_char_limit($slide['introtext'], $atts['intro_text_limit']);
                }
                $title = $slide['title'];
                $single_column .= ' [yt_columns grid="' . $atts['grid'] . '"] ';
                $single_column .= ' [yt_columns_item offset="' . $atts['offset'] . '" col="12"] ';
                if ($slide['image']) {
                    $single_column .= '<div class="col-sm-6" style="width:50%; margin:0;"><img src="' . yt_image_media($slide['image']) . '" alt="" /></div><div class="col-sm-6" style="width:50%; margin:0;">';
                } else {
                    $single_column .= '<div class="col-sm-12">';
                }
                if ($atts['title'] === 'yes' and isset($slide['title'])) {
                    $single_column .= '<h1 class="yt-timeline-item-title">';
                    if ($atts['link_title'] === 'yes') {
                        $single_column .= '<a href="' . yt_image_media($slide['link']) . '">';
                    }
                    $single_column .= $title;
                    if ($atts['link_title'] === 'yes') {
                        $single_column .= '</a>';
                    }
                    $single_column .= '</h1>';
                }
                if ($atts['date'] == 'yes') {
                    $single_column .= '<i class="fa fa-calendar"></i> ' . JHTML::_('date', $slide['created'], JText::_('DATE_FORMAT_LC3')) . ' // <i class="fa fa-book"></i> ' . $slide['category'] . ',' . $slide['category_alias'] . ' // <i class="fa fa-user"></i> by ' . $slide['author_name'] . '.';
                }
                $single_column .= '<div class="yt_contentstyle_content">' . $slide['introtext'] . '</div>';
                $single_column .= '</div> [/yt_columns_item] ';
                $single_column .= ' [/yt_columns] ';
                if ($limit++ == $atts['limit']) {
                    break;
                }
            }
            $return = parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $single_column));
            break;
    }
    JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/content_style/css/content_style.css");
    return $return;
}
Example #6
0
<div class="banner-bg">
  <?php 
get_slides();
if (have_posts()) {
    while (have_posts()) {
        the_post();
        ?>
  <?php 
        $picture = wp_get_attachment_image_src(get_post_thumbnail_id(), 'homepage-slider');
        ?>
  <div class="banner-bg-item"><img src="<?php 
        echo $picture[0];
        ?>
" alt=""></div>
<?php 
    }
} else {
    ?>
  <div class="banner-bg-item"><img src="<?php 
    echo get_template_directory_uri();
    ?>
/homepage_v1/img/M_M_0002.jpg" alt=""></div>
<?php 
}
?>
</div>