Exemplo n.º 1
0
<?php

if (function_exists('rwmb_meta')) {
    $fave_gallery = rwmb_meta('fave_gallery_posts', $args = array('type' => 'image'), get_the_ID());
}
$unique_key = fave_unique_key();
?>

<?php 
if (!empty($fave_gallery)) {
    ?>
<div class="post-gallery-wrap">
	<div class="post-gallery">
		<!--<div class="post-gallery-top">
			<div class="post-gallery-title">
				<i class="fa fa-picture-o"></i>
			</div>
		</div>-->
		<div class="post-gallery-body">
			<!-- big images -->
			<div id="sync1-<?php 
    echo intval($unique_key);
    ?>
" class="images-owl-carousel">
				<?php 
    if ($fave_gallery != NULL) {
        foreach ($fave_gallery as $gal_img) {
            $fave_image = wp_get_attachment_image_src($gal_img['ID'], array(800, 600));
            $fave_image_full = wp_get_attachment_image_src($gal_img['ID'], 'full');
            ?>
						
Exemplo n.º 2
0
function fav_custom_post_gallery($atts, $content = null)
{
    extract(shortcode_atts(array('post_from' => '', 'category_id' => '', 'sort' => '', 'posts_limit' => '', 'offset' => '', 'gallery_title' => '', 'module_bg' => '', 'module_padding' => ''), $atts));
    ob_start();
    $video_link = $video_duration = '';
    $wp_query_args = array('ignore_sticky_posts' => 1);
    if ($post_from == "category_posts") {
        if (!empty($category_id)) {
            $wp_query_args['tax_query'] = array(array('taxonomy' => 'gallery-categories', 'field' => 'term_id', 'terms' => $category_id));
        }
    }
    if ($post_from == "featured") {
        $wp_query_args['meta_key'] = 'fave_gallery_featured';
        $wp_query_args['meta_value'] = '1';
    }
    $current_day = date('j');
    switch ($sort) {
        case 'popular':
            $wp_query_args['meta_key'] = 'fave-post_views';
            $wp_query_args['orderby'] = 'meta_value_num';
            $wp_query_args['order'] = 'DESC';
            break;
        case 'review_high':
            $wp_query_args['meta_key'] = '';
            //td_review::$td_review_key;
            $wp_query_args['orderby'] = 'meta_value_num';
            $wp_query_args['order'] = 'DESC';
            break;
        case 'random_posts':
            $wp_query_args['orderby'] = 'rand';
            break;
        case 'alphabetical_order':
            $wp_query_args['orderby'] = 'title';
            $wp_query_args['order'] = 'ASC';
            break;
        case 'comment_count':
            $wp_query_args['orderby'] = 'comment_count';
            $wp_query_args['order'] = 'DESC';
            break;
        case 'random_today':
            $wp_query_args['orderby'] = 'rand';
            $wp_query_args['year'] = date('Y');
            $wp_query_args['monthnum'] = date('n');
            $wp_query_args['day'] = date('j');
            break;
        case 'random_7_day':
            $wp_query_args['orderby'] = 'rand';
            $wp_query_args['date_query'] = array('column' => 'post_date_gmt', 'after' => '1 week ago');
            break;
    }
    //custom pagination limit
    if (empty($posts_limit)) {
        $posts_limit = get_option('posts_per_page');
    }
    $wp_query_args['posts_per_page'] = $posts_limit;
    // offset
    if (!empty($offset) and $paged > 1) {
        $wp_query_args['offset'] = $offset + ($paged - 1) * $posts_limit;
    } else {
        $wp_query_args['offset'] = $offset;
    }
    $wp_query_args['post_type'] = 'gallery';
    $the_query = new WP_Query($wp_query_args);
    $unique_key = fave_unique_key();
    $style = $bg = $padding = '';
    if (!empty($module_bg)) {
        $bg = "background-color:" . $module_bg . ";";
    }
    if (!empty($module_padding)) {
        $padding = "padding:" . $module_padding . ";";
    }
    if (!empty($bg) || !empty($padding)) {
        $style = 'style="' . $bg . ' ' . $padding . '"';
    }
    ?>


	<div class="post-gallery-wrap" <?php 
    echo $style;
    ?>
>
		<div class="post-gallery">
			
			<div class="post-gallery-top">
				<div class="post-gallery-title">
					<i class="fa fa-picture-o"></i> <?php 
    echo esc_attr($gallery_title);
    ?>
				</div>
			</div>

			<div class="post-gallery-body">
				<!-- big images -->
				<div id="sync1-<?php 
    echo $unique_key;
    ?>
" class="images-owl-carousel">
					
					<?php 
    while ($the_query->have_posts()) {
        $the_query->the_post();
        ?>

					<div class="item">
						<?php 
        the_post_thumbnail('gal-big');
        ?>
					</div><!-- item -->
					
					<?php 
    }
    ?>

				</div><!-- owl-carousel -->

				<!-- thumbnails -->
				<div id="sync2-<?php 
    echo $unique_key;
    ?>
" class="thumbnails-owl-carousel">
					
					<?php 
    while ($the_query->have_posts()) {
        $the_query->the_post();
        ?>
					<div class="item">
						<?php 
        the_post_thumbnail('gal-thumb');
        ?>
					</div><!-- item -->
					<?php 
    }
    ?>

				</div><!-- owl-carousel -->
			</div><!-- post-gallery-body -->
		</div><!-- post-gallery -->
	</div><!-- post-gallery-wrap -->

	<?php 
    wp_register_style('fave-slick-css', get_template_directory_uri() . '/slick/slick.css', array(), '1.1.2', 'all');
    wp_register_style('fave-slick-theme', get_template_directory_uri() . '/slick/slick-theme.css', array(), '1.1.2', 'all');
    wp_enqueue_style('fave-slick-css');
    wp_enqueue_style('fave-slick-theme');
    wp_enqueue_script('fave-slick.min.js', get_template_directory_uri() . '/slick/slick.min.js', 'jquery', '1.1.2', true);
    if (is_rtl()) {
        $magzilla_rtl = 'true';
    } else {
        $magzilla_rtl = 'false';
    }
    ?>

	<script type="text/javascript">
	jQuery(document).ready(function($) {

		var sync1 = $("#sync1-<?php 
    echo $unique_key;
    ?>
");
		var sync2 = $("#sync2-<?php 
    echo $unique_key;
    ?>
");

			sync1.slick({
				rtl: <?php 
    echo $magzilla_rtl;
    ?>
,
				slidesToShow: 1,
				slidesToScroll: 1,
				adaptiveHeight: true,
				arrows: true,
				prevArrow: "<button type='button' class='slick-prev'><i class='fa fa-chevron-left'></i></button>",
				nextArrow: "<button type='button' class='slick-next'><i class='fa fa-chevron-right'></i></button>",
				fade: true,
				asNavFor: sync2
			});
			sync2.slick({
				rtl: <?php 
    echo $magzilla_rtl;
    ?>
,
				slidesToShow: 8,
				slidesToScroll: 1,
				asNavFor: sync1,
				dots: false,
				arrows: false,
				centerMode: true,
				focusOnSelect: true,
				responsive: [
					{
						breakpoint: 1199,
						settings: {
							slidesToShow: 8,
							slidesToScroll: 1,
						}
					},
					{
						breakpoint: 979,
						settings: {
							slidesToShow: 5,
							slidesToScroll: 1,
						}
					},
					{
						breakpoint: 768,
						settings: {
							slidesToShow: 5,
							slidesToScroll: 1
						}
					},
					{
						breakpoint: 480,
						settings: {
							slidesToShow: 3,
							slidesToScroll: 1,
						}
					},
					{
						breakpoint: 450,
						settings: {
							slidesToShow: 2,
							slidesToScroll: 1,
						}
					}
				]
			});

	});


	</script>
	
	
	<?php 
    wp_reset_postdata();
    $result = ob_get_contents();
    ob_end_clean();
    return $result;
}
Exemplo n.º 3
0
/**
 *   ----------------------------------------------------------------------------------------------------------------------------------------------------
 *   50.0 - Gallery Shortcode
 *   ----------------------------------------------------------------------------------------------------------------------------------------------------
 */
function fave_gallery_shortcode($output = '', $atts, $content = false, $tag = false)
{
    ob_start();
    //check for gallery  = slide
    if (!empty($atts) and !empty($atts['favethemes_select_gallery_slide']) and $atts['favethemes_select_gallery_slide'] == 'slide') {
        $image_ids = explode(',', $atts['ids']);
        //check to make sure we have images
        if (count($image_ids) == 1 and !is_numeric($image_ids[0])) {
            return;
        }
        $image_ids = array_map('trim', $image_ids);
        //trim elements of the $ids_gallery array
        //generate unique gallery slider id
        $gallery_slider_unique_id = fave_unique_key();
        ?>


        <script>
            jQuery(document).ready( function($) {
                $('.magzilla-popup-<?php 
        echo $gallery_slider_unique_id;
        ?>
').magnificPopup({
                    type: 'image',
                    closeOnContentClick: true,
                    gallery:{
                        enabled:true
                    }
                });
            });
         </script>

        <div class="post-gallery-wrap">
            <div class="post-gallery">
                <div class="post-gallery-top">
                    <div class="post-gallery-title">
                        <i class="fa fa-picture-o"></i> <?php 
        if (isset($atts['favethemes_gallery_title_input'])) {
            echo $atts['favethemes_gallery_title_input'];
        }
        ?>
                    </div>
                </div>
                <div class="post-gallery-body">
                    <!-- big images -->
                    <div id="sync1-<?php 
        echo $gallery_slider_unique_id;
        ?>
" class="owl-carousel images-owl-carousel">

                        <?php 
        foreach ($image_ids as $image_id) {
            ?>

                            <?php 
            $slide_big_img = wp_get_attachment_image_src($image_id, 'gal-big');
            // 800 x 600 - for small images slide
            ?>
                            <?php 
            $slide_popup_img = wp_get_attachment_image_src($image_id, 'full');
            ?>
                            <?php 
            $thumb_img = get_post($image_id);
            // Get post by ID
            ?>

                            <div class="item">
                                <a class="magzilla-popup-<?php 
            echo $gallery_slider_unique_id;
            ?>
" href="<?php 
            echo esc_url($slide_popup_img[0]);
            ?>
">
                                    <img src="<?php 
            echo $slide_big_img[0];
            ?>
" alt="image">
                                </a>
                                <div class="gallery-caption-wrap">
                                    <span class="gallery-caption"><?php 
            echo $thumb_img->post_excerpt;
            ?>
</span>
                                </div>
                            </div><!-- item -->

                        <?php 
        }
        ?>

                    </div><!-- owl-carousel -->

                    <!-- thumbnails -->
                    <div id="sync2-<?php 
        echo $gallery_slider_unique_id;
        ?>
" class="owl-carousel thumbnails-owl-carousel">
                        <?php 
        foreach ($image_ids as $image_id) {
            ?>
                            <?php 
            $slide_thumb_img = wp_get_attachment_image_src($image_id, 'gal-thumb');
            // 120 x 90 - for small images slide
            ?>
                            <div class="item">
                                <img src="<?php 
            echo $slide_thumb_img[0];
            ?>
" alt="image">
                            </div><!-- item -->
                        <?php 
        }
        ?>

                    </div><!-- owl-carousel -->
                </div><!-- post-gallery-body -->
            </div><!-- post-gallery -->
        </div><!-- post-gallery-wrap -->

        <?php 
        wp_register_style('fave-slick-css', get_template_directory_uri() . '/slick/slick.css', array(), '1.1.2', 'all');
        wp_register_style('fave-slick-theme', get_template_directory_uri() . '/slick/slick-theme.css', array(), '1.1.2', 'all');
        wp_enqueue_style('fave-slick-css');
        wp_enqueue_style('fave-slick-theme');
        wp_enqueue_script('fave-slick.min.js', get_template_directory_uri() . '/slick/slick.min.js', 'jquery', '1.1.2', true);
        if (is_rtl()) {
            $magzilla_rtl = 'true';
        } else {
            $magzilla_rtl = 'false';
        }
        ?>

        <script type="text/javascript">
            jQuery(document).ready(function($) {

                var sync1 = $("#sync1-<?php 
        echo $gallery_slider_unique_id;
        ?>
");
                var sync2 = $("#sync2-<?php 
        echo $gallery_slider_unique_id;
        ?>
");

                sync1.slick({
                    rtl: <?php 
        echo $magzilla_rtl;
        ?>
,
                    slidesToShow: 1,
                    slidesToScroll: 1,
                    adaptiveHeight: true,
                    arrows: true,
                    prevArrow: "<button type='button' class='slick-prev'><i class='fa fa-chevron-left'></i></button>",
                    nextArrow: "<button type='button' class='slick-next'><i class='fa fa-chevron-right'></i></button>",
                    fade: true,
                    asNavFor: sync2
                });
                sync2.slick({
                    rtl: <?php 
        echo $magzilla_rtl;
        ?>
,
                    slidesToShow: 8,
                    slidesToScroll: 1,
                    asNavFor: sync1,
                    dots: false,
                    arrows: false,
                    centerMode: true,
                    focusOnSelect: true,
                    responsive: [
                        {
                            breakpoint: 1199,
                            settings: {
                                slidesToShow: 8,
                                slidesToScroll: 1,
                            }
                        },
                        {
                            breakpoint: 979,
                            settings: {
                                slidesToShow: 5,
                                slidesToScroll: 1,
                            }
                        },
                        {
                            breakpoint: 768,
                            settings: {
                                slidesToShow: 5,
                                slidesToScroll: 1
                            }
                        },
                        {
                            breakpoint: 480,
                            settings: {
                                slidesToShow: 3,
                                slidesToScroll: 1,
                            }
                        },
                        {
                            breakpoint: 450,
                            settings: {
                                slidesToShow: 3,
                                slidesToScroll: 1,
                            }
                        }
                    ]
                });
            });
        </script>


        <?php 
    }
    //end main if
    $result = ob_get_contents();
    ob_end_clean();
    return $result;
}
Exemplo n.º 4
0
function fav_post_slider($atts, $content = null)
{
    extract(shortcode_atts(array('slider_type' => '', 'slider_text_align' => '', 'post_from' => '', 'category_id' => '', 'category_ids' => '', 'image_crop' => '', 'hide_cat' => '', 'sort' => '', 'posts_limit' => '', 'slider_auto' => '', 'stop_on_hover' => '', 'navigation' => '', 'bullets_pagination' => '', 'touch_drag' => 'true', 'slide_loop' => 'false', 'rewind_nav' => '', 'lazy_load' => '', 'module_meta' => '', 'author_name' => '', 'time_diff' => '', 'post_date' => '', 'post_time' => '', 'post_view_count' => '', 'post_comment_count' => '', 'module_bg' => '', 'module_padding' => ''), $atts));
    ob_start();
    $style = $bg = $padding = '';
    if (!empty($module_bg)) {
        $bg = "background-color:" . $module_bg . ";";
    }
    if (!empty($module_padding)) {
        $padding = "padding:" . $module_padding . ";";
    }
    if (!empty($bg) || !empty($padding)) {
        $style = 'style="' . $bg . ' ' . $padding . '"';
    }
    //do the query
    $wp_query_args = array('ignore_sticky_posts' => 1);
    if ($post_from == "category_posts") {
        if (!empty($category_id) and empty($category_ids)) {
            $category_ids = $category_id;
        }
        if (!empty($category_ids)) {
            $wp_query_args['cat'] = $category_ids;
        }
    }
    if ($post_from == "featured") {
        $wp_query_args['meta_key'] = 'fave_featured';
        $wp_query_args['meta_value'] = '1';
    }
    $current_day = date('j');
    switch ($sort) {
        case 'popular':
            $wp_query_args['meta_key'] = 'fave-post_views';
            $wp_query_args['orderby'] = 'meta_value_num';
            $wp_query_args['order'] = 'DESC';
            break;
        case 'review_high':
            $wp_query_args['meta_key'] = '';
            //td_review::$td_review_key;
            $wp_query_args['orderby'] = 'meta_value_num';
            $wp_query_args['order'] = 'DESC';
            break;
        case 'random_posts':
            $wp_query_args['orderby'] = 'rand';
            break;
        case 'alphabetical_order':
            $wp_query_args['orderby'] = 'title';
            $wp_query_args['order'] = 'ASC';
            break;
        case 'comment_count':
            $wp_query_args['orderby'] = 'comment_count';
            $wp_query_args['order'] = 'DESC';
            break;
        case 'random_today':
            $wp_query_args['orderby'] = 'rand';
            $wp_query_args['year'] = date('Y');
            $wp_query_args['monthnum'] = date('n');
            $wp_query_args['day'] = date('j');
            break;
        case 'random_7_day':
            $wp_query_args['orderby'] = 'rand';
            $wp_query_args['date_query'] = array('column' => 'post_date_gmt', 'after' => '1 week ago');
            break;
    }
    //custom pagination limit
    if (empty($posts_limit)) {
        $posts_limit = get_option('posts_per_page');
    }
    $wp_query_args['posts_per_page'] = $posts_limit;
    $the_query = new WP_Query($wp_query_args);
    $unique_key = fave_unique_key();
    if (is_rtl()) {
        $magzilla_rtl = 'true';
    } else {
        $magzilla_rtl = 'false';
    }
    ?>

        <script>
        	jQuery(document).ready(function($) {

		        var $elements = $( '[data-vc-stretch-content="true"]' );
		        $.each( $elements, function ( key, item ) {
			        var $el = $( this );
			        $el.children().children().children().children().children().addClass( 'banner-stretch-content' );


		        } );

		        var banner_slider = function () {
			        $('#owl-carousel-grid-banner-slide-<?php 
    echo $unique_key;
    ?>
').owlCarousel({
				        rtl: <?php 
    echo $magzilla_rtl;
    ?>
,
				        loop: <?php 
    echo $slide_loop;
    ?>
,
				        touchDrag: <?php 
    echo $touch_drag;
    ?>
,
				        items: 1,

				        //Autoplay
				        autoplay: <?php 
    echo $slider_auto;
    ?>
,
				        autoplayHoverPause: <?php 
    echo $stop_on_hover;
    ?>
,

				        // Navigation
				        nav: <?php 
    echo $navigation;
    ?>
,
				        navText: ["<i class='fa fa-chevron-left'></i>", "<i class='fa fa-chevron-right'></i>"],
				        navRewind: <?php 
    echo $rewind_nav;
    ?>
,
				        dots: <?php 
    echo $bullets_pagination;
    ?>
,

				        // Responsive
				        responsiveClass: true,
				        responsiveRefreshRate: 200,
				        responsiveBaseWidth: window,

				        //Lazy load
				        lazyLoad: <?php 
    echo $lazy_load;
    ?>
,
				        lazyFollow: true,
				        lazyEffect: "fade",
			        });
		        }

		        if( $('#owl-carousel-grid-banner-slide-<?php 
    echo $unique_key;
    ?>
').hasClass('banner-stretch-content') ) {

			        $(window).load(function() {

				        banner_slider();

			        });

		        } else {
			            banner_slider();
		        }

});
</script>


<?php 
    if ($slider_type == "fullwidth_slider") {
        ?>

<div class="grid-banner banner-slide" <?php 
        echo $style;
        ?>
>
	<!-- owl-carousel-grid-banner-slide -->
	<div id="owl-carousel-grid-banner-slide-<?php 
        echo $unique_key;
        ?>
" class="owl-carousel">

		<?php 
        while ($the_query->have_posts()) {
            $the_query->the_post();
            ?>

			<?php 
            if (has_post_thumbnail()) {
                if ($image_crop == "yes") {
                    $featured_image = fave_featured_image(get_the_ID(), 1470, 650, true, true, true);
                } else {
                    $featured_image = fave_featured_image(get_the_ID(), 1470, 650, false);
                }
            } else {
                $featured_image = 'http://placehold.it/1170x400';
            }
            ?>
			<div <?php 
            post_class('slide');
            ?>
 <?php 
            echo fave_get_item_scope();
            ?>
>
				<div class="row row-no-padding">
					<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
						<div class="left-side">
							<!-- thumb -->
							<div class="thumb">
								<a href="<?php 
            the_permalink();
            ?>
"></a>
								<div class="thumb-content <?php 
            echo esc_attr($slider_text_align);
            ?>
">

									<?php 
            if ($hide_cat != 'no') {
                ?>
										<div class="category-label">
											<?php 
                get_template_part('inc/post', 'cats');
                ?>
										</div>
									<?php 
            }
            ?>

									<h2 itemprop="headline" class="gallery-title-big"><a itemprop="url" href="<?php 
            the_permalink();
            ?>
"><?php 
            the_title();
            ?>
</a></h2>
									<ul class="list-inline post-meta">
										<?php 
            fave_vc_modules_meta($module_meta, $author_name, $time_diff, $post_date, $post_time, $post_view_count, $post_comment_count);
            ?>
									</ul><!-- .post-meta -->
								</div>
								<div class="slide-image-wrap">
									<?php 
            get_template_part('inc/article', 'icon');
            ?>
									<img itemprop="image" class="featured-image lazyOwl" width="1170" height="440" data-src="<?php 
            echo $featured_image;
            ?>
" src="<?php 
            echo $featured_image;
            ?>
" alt="<?php 
            the_title();
            ?>
">
								</div><!-- slide-image-wrap -->
							</div>
						</div>
					</div><!-- col-xs-12 col-sm-12 col-md-12 col-lg-12 -->
				</div><!-- row row-no-padding -->
			</div><!-- slide -->

		<?php 
        }
        ?>

		<?php 
        /* Restore original Post Data */
        wp_reset_postdata();
        ?>

	</div><!-- owl-carousel-grid-banner-slide -->
</div>

<?php 
    } elseif ($slider_type == "grid_slider") {
        ?>

<div class="grid-banner grid-banner-slide" <?php 
        echo $style;
        ?>
>
	<!-- owl-carousel-grid-banner-slide -->
	<div id="owl-carousel-grid-banner-slide-<?php 
        echo $unique_key;
        ?>
" class="owl-carousel">

		<?php 
        $i = 0;
        $post_counter = 0;
        ?>

		<?php 
        while ($the_query->have_posts()) {
            $the_query->the_post();
            $i++;
            $post_counter++;
            ?>

			<?php 
            if ($i == 1) {
                ?>
				<div <?php 
                post_class('slide');
                ?>
 <?php 
                echo fave_get_item_scope();
                ?>
>
					<div class="row row-no-padding">
					<?php 
            }
            ?>


					<?php 
            if ($i == 1) {
                ?>
						<div class="col-xs-12 col-sm-8 col-md-8 col-lg-8">
							<div class="left-side">
								<!-- thumb -->
								<div class="thumb">
									<a href="<?php 
                the_permalink();
                ?>
"></a>
									<div class="thumb-content">
										<?php 
                if ($hide_cat != 'no') {
                    ?>
											<div class="category-label">
												<?php 
                    get_template_part('inc/post', 'cats');
                    ?>
											</div>
										<?php 
                }
                ?>

										<h2 itemprop="headline" class="gallery-title-big"><a itemprop="url" href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                ?>
</a></h2>
										<ul class="list-inline post-meta">
											<?php 
                fave_vc_modules_meta($module_meta, $author_name, $time_diff, $post_date, $post_time, $post_view_count, $post_comment_count);
                ?>
										</ul><!-- .post-meta -->
									</div>
									<?php 
                if (has_post_thumbnail()) {
                    ?>
									<div class="slide-image-wrap">
										<?php 
                    get_template_part('inc/article', 'icon');
                    ?>

										<?php 
                    if ($image_crop == "yes") {
                        ?>
										<img class="featured-image lazyOwl" width="780" height="440" data-src="<?php 
                        echo fave_featured_image(get_the_ID(), 780, 440, true, true, true);
                        ?>
" src="<?php 
                        echo fave_featured_image(get_the_ID(), 780, 440, true, true, true);
                        ?>
" alt="<?php 
                        the_title();
                        ?>
">
										<?php 
                    } else {
                        ?>
										<img class="featured-image lazyOwl" width="780" height="440" data-src="<?php 
                        echo fave_featured_image(get_the_ID(), 780, 440, false);
                        ?>
" src="<?php 
                        echo fave_featured_image(get_the_ID(), 780, 440, false);
                        ?>
" alt="<?php 
                        the_title();
                        ?>
">
										<?php 
                    }
                    ?>
									</div><!-- slide-image-wrap -->
									<?php 
                }
                ?>
								</div>
							</div>
						</div><!-- col-xs-8 col-sm-8 col-md-8 col-lg-8 -->
					<?php 
            }
            ?>

					<?php 
            if ($i == 2) {
                ?>
						<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
							<div class="right-side">

							<?php 
            }
            ?>
								<!-- thumb -->
								<?php 
            if ($i == 2 || $i == 3) {
                ?>
									<div class="col-xs-6 col-sm-12 col-md-12 col-lg-12">
										<div <?php 
                post_class('thumb');
                ?>
 <?php 
                echo fave_get_item_scope();
                ?>
>
											<a href="<?php 
                the_permalink();
                ?>
"></a>
											<div class="thumb-content">
												<?php 
                if ($hide_cat != 'no') {
                    ?>
													<div class="category-label">
														<?php 
                    get_template_part('inc/post', 'cats');
                    ?>
													</div>
												<?php 
                }
                ?>
												<h2 itemprop="headline" class="gallery-title-small"><a itemprop="url" href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                ?>
</a></h2>
												<ul class="list-inline post-meta">
													<?php 
                fave_vc_modules_meta($module_meta, $author_name, $time_diff, $post_date, $post_time, $post_view_count, $post_comment_count);
                ?>
												</ul><!-- .post-meta -->
											</div>
											<?php 
                if (has_post_thumbnail()) {
                    ?>
											<div class="slide-image-wrap">
												<?php 
                    get_template_part('inc/article', 'icon');
                    ?>
												<?php 
                    if ($image_crop == "yes") {
                        ?>
												<img itemprop="image" class="featured-image lazyOwl" width="390" height="220" data-src="<?php 
                        echo fave_featured_image(get_the_ID(), 390, 220, true, true, true);
                        ?>
" src="<?php 
                        echo fave_featured_image(get_the_ID(), 390, 220, true, true, true);
                        ?>
" alt="<?php 
                        the_title();
                        ?>
">
												<?php 
                    } else {
                        ?>
												<img itemprop="image" class="featured-image lazyOwl" width="390" height="220" data-src="<?php 
                        echo fave_featured_image(get_the_ID(), 390, 220, false);
                        ?>
" src="<?php 
                        echo fave_featured_image(get_the_ID(), 390, 220, false);
                        ?>
" alt="<?php 
                        the_title();
                        ?>
">
												<?php 
                    }
                    ?>
											</div><!-- slide-image-wrap -->
											<?php 
                }
                ?>

										</div>
									</div>
								<?php 
            }
            ?>

								<?php 
            if ($i == 3 || $i == 2 && $post_counter == $the_query->post_count) {
                ?>
								
							</div><!-- right-side -->
						</div><!-- col-xs-4 col-sm-4 col-md-4 col-lg-4 -->
					<?php 
            }
            ?>

					<?php 
            if ($i == 3 || $post_counter == $the_query->post_count) {
                $i = 0;
                ?>
					</div><!-- row row-no-padding -->
				</div><!-- slide -->
			<?php 
            }
            ?>

		<?php 
        }
        ?>

		<?php 
        /* Restore original Post Data */
        wp_reset_postdata();
        ?>

	</div><!-- owl-carousel-grid-banner-slide -->

</div>

<?php 
    }
    ?>

<?php 
    $result = ob_get_contents();
    ob_end_clean();
    return $result;
}
Exemplo n.º 5
0
function magzilla_get_social($social_profile, $icons_type, $icons_style, $icon_size = '32', $width, $height, $m_r, $m_b, $newtab = 'yes')
{
    global $ft_option;
    $newtab = '';
    if ($newtab == 'yes') {
        $newtab = "target=\"_blank\"";
    }
    $final_width = '';
    if (!empty($width)) {
        $final_width = 'width: ' . (preg_match('/(px|em|\\%|pt|cm)$/', $width) ? $width : $width . 'px') . ';';
    }
    $final_height = '';
    $line_height = '';
    if (!empty($height)) {
        $final_height = 'height: ' . (preg_match('/(px|em|\\%|pt|cm)$/', $height) ? $height : $height . 'px') . ';';
        $line_height = 'line-height: ' . (preg_match('/(px|em|\\%|pt|cm)$/', $height) ? $height : $height . 'px') . ';';
    }
    $margin_right = '';
    $margin_bottom = '';
    if (!empty($m_r)) {
        $margin_right = 'margin-right: ' . (preg_match('/(px|em|\\%|pt|cm)$/', $m_r) ? $m_r : $m_r . 'px') . ';';
    }
    if (!empty($m_b)) {
        $margin_bottom = 'margin-bottom: ' . (preg_match('/(px|em|\\%|pt|cm)$/', $m_b) ? $m_b : $m_b . 'px') . ';';
    }
    $unique_key = fave_unique_key();
    ?>

	<style type="text/css">
		.social-<?php 
    echo $unique_key;
    ?>
 li a i {
			text-align: center;
			float: left;
			font-size: <?php 
    echo $icon_size;
    ?>
px;
			margin: 0 auto;
			<?php 
    echo $margin_right;
    ?>
			<?php 
    echo $margin_bottom;
    ?>
			<?php 
    echo $final_width;
    ?>
			<?php 
    echo $final_height;
    ?>
			<?php 
    echo $line_height;
    ?>
		}
	</style>

	<div class="social-<?php 
    echo $unique_key;
    ?>
 magzilla-social-icons <?php 
    echo $icons_type . ' ' . $icons_style;
    ?>
">
		<?php 
    // Loop through array and output the item only if the field is not empty
    foreach ($social_profile as $key => $val) {
        if (!empty($val)) {
            echo '<li class="ft-' . esc_attr($key) . '">';
            echo '<a href="' . esc_url($val) . '" target="_blank">
					<i class="fa fa-' . esc_attr($key) . '"></i></a>';
            echo '</li>';
        }
    }
    ?>
	</div>
<div class="clearfix"></div>
	<?php 
}
Exemplo n.º 6
0
function fav_video_gallery($atts, $content = null)
{
    extract(shortcode_atts(array('post_from' => '', 'category_id' => '', 'sort' => '', 'autors_id' => '', 'posts_limit' => '', 'offset' => '', 'playlist_title' => '', 'module_bg' => '', 'module_padding' => ''), $atts));
    ob_start();
    $video_link = $video_duration = '';
    $wp_query_args = array('ignore_sticky_posts' => 1);
    if ($post_from == "category_videos" && !empty($category_id)) {
        $wp_query_args['tax_query'] = array(array('taxonomy' => 'video-categories', 'field' => 'term_id', 'terms' => $category_id));
    }
    if ($post_from == "featured") {
        $wp_query_args['meta_key'] = 'fave_video_featured';
        $wp_query_args['meta_value'] = '1';
    }
    $current_day = date('j');
    switch ($sort) {
        case 'popular':
            $wp_query_args['meta_key'] = 'fave-post_views';
            $wp_query_args['orderby'] = 'meta_value_num';
            $wp_query_args['order'] = 'DESC';
            break;
        case 'review_high':
            $wp_query_args['meta_key'] = '';
            $wp_query_args['orderby'] = 'meta_value_num';
            $wp_query_args['order'] = 'DESC';
            break;
        case 'random_posts':
            $wp_query_args['orderby'] = 'rand';
            break;
        case 'alphabetical_order':
            $wp_query_args['orderby'] = 'title';
            $wp_query_args['order'] = 'ASC';
            break;
        case 'comment_count':
            $wp_query_args['orderby'] = 'comment_count';
            $wp_query_args['order'] = 'DESC';
            break;
        case 'random_today':
            $wp_query_args['orderby'] = 'rand';
            $wp_query_args['year'] = date('Y');
            $wp_query_args['monthnum'] = date('n');
            $wp_query_args['day'] = date('j');
            break;
        case 'random_7_day':
            $wp_query_args['orderby'] = 'rand';
            $wp_query_args['date_query'] = array('column' => 'post_date_gmt', 'after' => '1 week ago');
            break;
    }
    //custom pagination limit
    if (empty($posts_limit)) {
        $posts_limit = get_option('posts_per_page');
    }
    $wp_query_args['posts_per_page'] = $posts_limit;
    // offset
    if (!empty($offset) and $paged > 1) {
        $wp_query_args['offset'] = $offset + ($paged - 1) * $posts_limit;
    } else {
        $wp_query_args['offset'] = $offset;
    }
    $wp_query_args['post_type'] = 'video';
    $the_query_1 = new WP_Query($wp_query_args);
    $the_query = new WP_Query($wp_query_args);
    $unique_key = fave_unique_key();
    $style = $bg = $padding = '';
    if (!empty($module_bg)) {
        $bg = "background-color:" . $module_bg . ";";
    }
    if (!empty($module_padding)) {
        $padding = "padding:" . $module_padding . ";";
    }
    if (!empty($bg) || !empty($padding)) {
        $style = 'style="' . $bg . ' ' . $padding . '"';
    }
    ?>
	
	<script type="text/javascript">
		function htmlUpdateSize(){
	    	// Get the dimensions of the viewport
	    	var height = jQuery(".player-holder-<?php 
    echo $unique_key;
    ?>
 .player").height();
	    	jQuery('.scroll-pane-<?php 
    echo $unique_key;
    ?>
').css({
	    		height: [height],
	    	});
		};
		jQuery(document).ready(htmlUpdateSize);    // When the page first loads
		jQuery(window).resize(htmlUpdateSize);     // When the browser changes size

		jQuery(document).ready(function($) {
			$( ".favethemes-video-<?php 
    echo $unique_key;
    ?>
 a" ).click(function() {
			  	$(this).parent().addClass('selected').siblings().removeClass('selected');
				$('#video-player-<?php 
    echo $unique_key;
    ?>
 iframe').attr('src', $(this).attr('href'));
				return false;
			});
		});

	</script>

<div class="featured-gallery video-gallery" <?php 
    echo $style;
    ?>
>
	
	<?php 
    if (!empty($playlist_title)) {
        ?>
	<div class="video-gallery-top">
		<div class="video-gallery-title">
			<i class="fa fa-video-camera"></i> <?php 
        echo esc_attr($playlist_title);
        ?>
		</div>
	</div>
	<?php 
    }
    ?>

	<div id="video-player-<?php 
    echo $unique_key;
    ?>
" class="video-gallery-holder">
		<div class="row row-no-padding">
			<div class="col-xs-12 col-sm-8 col-md-8 col-lg-8">
				<div class="player-holder player-holder-<?php 
    echo $unique_key;
    ?>
">
					<div class="player">
						
						<?php 
    $i = 0;
    ?>
						<?php 
    while ($the_query_1->have_posts()) {
        $the_query_1->the_post();
        $i++;
        $video_channel = get_post_meta(get_the_ID(), 'fave_video_channel', true);
        $video_id = get_post_meta(get_the_ID(), 'fave_video_id', true);
        $video_duration = get_post_meta(get_the_ID(), 'fave_video_duration', true);
        if ($video_channel == 'vimeo') {
            $video_link = "https://player.vimeo.com/video/" . esc_attr($video_id) . "?color=ffcc3a";
        } elseif ($video_channel == 'youtube') {
            $video_link = "https://www.youtube.com/embed/" . esc_attr($video_id) . "";
        } else {
            $video_link = "";
        }
        ?>

						<iframe src="<?php 
        echo esc_url($video_link);
        ?>
" frameborder="0" allowfullscreen></iframe>

						<?php 
        if ($i == 1) {
            break;
        }
        ?>

						<?php 
    }
    ?>

					</div>
				</div>
			</div>
			<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
				<div class="playlist-holder scroll-pane scroll-pane-<?php 
    echo esc_attr($unique_key);
    ?>
">

					<?php 
    $i = 0;
    ?>
					<?php 
    while ($the_query->have_posts()) {
        $the_query->the_post();
        $i++;
        $video_channel = get_post_meta(get_the_ID(), 'fave_video_channel', true);
        $video_id = get_post_meta(get_the_ID(), 'fave_video_id', true);
        $video_duration = get_post_meta(get_the_ID(), 'fave_video_duration', true);
        if ($video_channel == 'vimeo') {
            $video_link = "https://player.vimeo.com/video/" . esc_attr($video_id) . "?color=ffcc3a";
        } elseif ($video_channel == 'youtube') {
            $video_link = "https://www.youtube.com/embed/" . esc_attr($video_id) . "";
        } else {
            $video_link = "";
        }
        ?>

					<div class="playlist-video favethemes-video-<?php 
        echo esc_attr($unique_key);
        ?>
 <?php 
        if ($i == 1) {
            echo "selected";
        }
        ?>
">
						<a href="<?php 
        echo esc_url($video_link);
        ?>
">
							<div class="media">
								<div class="media-left">
									<img class="media-object" src="<?php 
        echo fave_featured_image(get_the_ID(), 160, 90, true, true, true);
        ?>
" alt="<?php 
        the_title();
        ?>
" alt="<?php 
        the_title();
        ?>
">
								</div>
								<div class="media-body">
									<div class="media-heading"><?php 
        the_title();
        ?>
</div>
									<?php 
        if (!empty($video_duration)) {
            ?>
									<i class="fa fa-clock-o"></i> <?php 
            echo esc_attr($video_duration);
            ?>
									<?php 
        }
        ?>
								</div>
							</div>
						</a>
					</div><!-- playlist-video -->

					<?php 
    }
    ?>

				</div>
			</div>
		</div>
	</div>
</div>
	<?php 
    $result = ob_get_contents();
    ob_end_clean();
    return $result;
}
Exemplo n.º 7
0
    function start_el(&$output, $object, $depth = 0, $args = array(), $id = 0)
    {
        parent::start_el($output, $object, $depth, $args);
        $fave_menu_type = $object->favemenutype;
        $fave_cat_id = $object->favemegamenu;
        $no_of_posts = $object->nav_no_of_posts;
        $fave_posts = $main_posts = $cat_main = $cat_list = $posts_area = $posts_area_end = NULL;
        $fave_subcategories = get_categories(array('child_of' => $fave_cat_id));
        $sub_cats_array = array();
        foreach ($fave_subcategories as $key => $cat_val) {
            $sub_cats_array[$cat_val->name] = $cat_val->term_id;
        }
        $parant_cat = array($fave_cat_id);
        $merge_cat_ids = array_merge($parant_cat, $sub_cats_array);
        if ($fave_menu_type == 3) {
            if ($fave_cat_id != NULL) {
                $j = 0;
                foreach ($merge_cat_ids as $fave_cat_id) {
                    $fave_posts = '';
                    $j++;
                    if ($j == 1) {
                        $active = 'active in';
                        $no_of_posts = $no_of_posts;
                    } else {
                        $active = '';
                        $no_of_posts = 4;
                    }
                    $fave_args = array('cat' => $fave_cat_id, 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => $no_of_posts, 'ignore_sticky_posts' => 1);
                    $fave_qry_latest = $mzine_img = NULL;
                    $fave_qry_latest = new WP_Query($fave_args);
                    $i = 1;
                    $featured_image = '';
                    if ($no_of_posts > 4 || $no_of_posts == '') {
                        $css_classes = 'slide';
                    } else {
                        $css_classes = 'col-xs-3 col-sm-3 col-md-3 col-lg-3';
                    }
                    while ($fave_qry_latest->have_posts()) {
                        $fave_qry_latest->the_post();
                        $menu_categories = get_the_category(get_the_ID());
                        $menu_cats_html = '';
                        if ($menu_categories) {
                            foreach ($menu_categories as $category) {
                                $cat_id = $category->cat_ID;
                                $cat_link = get_category_link($cat_id);
                                $menu_cats_html .= '<a class="cat-color-' . intval($cat_id) . '" href="' . esc_url($cat_link) . '">' . esc_html($category->name) . '</a>';
                            }
                        }
                        if ('gallery' == get_post_format()) {
                            // Gallery
                            $article_icon = '<div class="post-type-icon"><i class="fa fa-picture-o"></i></div>';
                        } elseif ('video' == get_post_format()) {
                            // Video
                            $article_icon = '<div class="post-type-icon"><i class="fa fa-video-camera"></i></div>';
                        } elseif ('audio' == get_post_format()) {
                            // Audio
                            $article_icon = '<div class="post-type-icon"><i class="fa fa-microphone"></i></div>';
                        } elseif ('link' == get_post_format()) {
                            // Link
                            $article_icon = '<div class="post-type-icon"><i class="fa fa-link"></i></div>';
                        } else {
                            $article_icon = '';
                        }
                        $fave_permalink = get_permalink(get_the_ID());
                        if (has_post_thumbnail()) {
                            $thumbnail = fave_featured_image(get_the_ID(), 260, 195, true, true, true);
                            $featured_image = '<div class="featured-image-wrap">
                                ' . $article_icon . '
                                <div class="category-label">' . $menu_cats_html . '</div>
                                <a href="' . $fave_permalink . '">
                                    <img class="featured-image lazyOwl" width="260" height="195" src="' . esc_url($thumbnail) . '" alt="' . get_the_title() . '">
                                </a>
                            </div>';
                        }
                        $fave_posts .= '<div class="' . $css_classes . '">
                                                <div class="menu-post">
                                                    ' . $featured_image . '
                                                    <article class="post">
                                                        <h2 class="post-title module-small-title"><a href="' . esc_url($fave_permalink) . '">' . get_the_title() . '</a></h2>
                                                    </article>
                                                </div>
                                            </div>';
                        $i++;
                    }
                    wp_reset_postdata();
                    if ($no_of_posts > 4 || $no_of_posts == '') {
                        $rnr_id = fave_unique_key();
                        if (is_rtl()) {
                            $magzilla_rtl = 'true';
                        } else {
                            $magzilla_rtl = 'false';
                        }
                        ?>

                        <script>
                        jQuery(document).ready(function($) {

                            $('#owl-carousel-menu-<?php 
                        echo esc_attr($rnr_id);
                        ?>
').owlCarousel({
                                rtl: <?php 
                        echo $magzilla_rtl;
                        ?>
,
                                loop: false,
                                touchDrag: false,

                                responsive:{
                                    0:{
                                        items:2
                                    },
                                    479:{
                                        items:4
                                    },
                                    768:{
                                        items:4
                                    },
                                    980:{
                                        items:4
                                    },
                                    1199:{
                                        items:4
                                    }
                                },

                                //Autoplay
                                autoPlay : false,
                                autoplayHoverPause : true,

                                // Navigation
                                nav : true,
                                navText : ["<i class='fa fa-chevron-left'></i>","<i class='fa fa-chevron-right'></i>"],
                                navRewind : true,
                                dots: false,

                                // Responsive
                                responsiveClass:true,
                                responsiveRefreshRate : 200,
                                responsiveBaseElement: window,

                                //Lazy load
                                lazyLoad : true,
                                lazyFollow : true,
                                lazyEffect : "fade",

                            });

                        });

                        </script>

                        <?php 
                        $slider_wrap = '<div id="owl-carousel-menu-' . esc_attr($rnr_id) . '" class="owl-carousel owl-carousel-menu">';
                        $slider_wrap_end = '</div>';
                    } else {
                        $slider_wrap = $slider_wrap_end = '';
                    }
                    $main_posts .= '<div role="tabpanel" class="tab-pane fade ' . esc_attr($active) . '" id="tab' . esc_attr($fave_cat_id) . '">
                                    <div class="row-sub-menu">
                                    ' . $slider_wrap . '
                                        ' . $fave_posts . '
                                    ' . $slider_wrap_end . '
                                    </div>
                                </div>';
                }
            }
            // End $fave_cat_id = null
        }
        // End $fave_menu_type == 3
        if ($fave_posts != NULL) {
            if (!empty($fave_subcategories)) {
                $posts_area = '<div class="col-xs-10 col-sm-10 col-md-10 col-lg-10 mega_menu"><div class="tab-content">';
                $posts_area_end = '</div></div>';
                $fave_cat = $object->favemegamenu;
                $cat_list .= '<li role="presentation" class="tab-link active">';
                $cat_list .= '<a href="#tab' . esc_attr($fave_cat) . '" role="tab" data-toggle="tab" aria-expanded="true">' . __('All', 'magzilla') . '</a>';
                $cat_list .= '</li>';
                foreach ($fave_subcategories as $key => $value) {
                    $cat_list .= '<li role="presentation" class="tab-link">';
                    $cat_list .= '<a href="#tab' . esc_attr($value->term_id) . '" role="tab" data-toggle="tab" aria-expanded="false">' . esc_attr($value->name) . '</a>';
                    $cat_list .= '</li>';
                }
                $cat_main .= '<div class="col-xs-2 col-sm-2 col-md-2 col-lg-2">';
                $cat_main .= '<ul class="nav menu-tab-nav text-right" role="tablist">';
                $cat_main .= $cat_list;
                $cat_main .= '</ul>';
                $cat_main .= '</div>';
            }
            $output .= '<ul class="dropdown-menu"><li>
                            <div class="yamm-content">
                                <div class="row">
                                    ' . $cat_main . '

                                    
                                    ' . $posts_area . '

                                        ' . $main_posts . '

                                    ' . $posts_area_end . '

                                </div>
                             </div>
                             </li></ul>';
        }
    }
Exemplo n.º 8
0
    /**
     * Front-end display of widget
     **/
    public function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $no_of_tweets = $instance['no_of_tweets'];
        $widget_type = $instance['slide_list'];
        $cacheTime = 20;
        $twitter_username = $instance['twitter_username'];
        $consumer_key = $instance['twitter_consumer_key'];
        $consumer_secret = $instance['twitter_consumer_secret'];
        $access_token = $instance['twitter_access_token'];
        $access_token_secret = $instance['twitter_access_token_secret'];
        if (!empty($twitter_username) && !empty($consumer_key) && !empty($consumer_secret) && !empty($access_token) && !empty($access_token_secret)) {
            $twitterData = get_transient('list_tweets');
            if (empty($twitterData)) {
                $twitterConnection = new TwitterOAuth($consumer_key, $consumer_secret, $access_token, $access_token_secret);
                $twitterData = $twitterConnection->get('statuses/user_timeline', array('screen_name' => $twitter_username, 'count' => "5"));
                $error = $twitterData->errors;
                // Save our new transient.
                if (!isset($error)) {
                    set_transient('list_tweets', $twitterData, 60 * $cacheTime);
                }
            }
            echo $before_widget;
            echo $before_title;
            ?>
			<a href="http://twitter.com/<?php 
            echo $twitter_username;
            ?>
"><?php 
            echo $title;
            ?>
</a>
		<?php 
            echo $after_title;
            if (!isset($error) && is_array($twitterData)) {
                $i = 0;
                $hyperlinks = true;
                $twitter_users = true;
                $update = true;
                echo '<div class="widget-body">';
                $encode_utf8 = "";
                if ($widget_type == 'tweet_list') {
                    foreach ($twitterData as $item) {
                        $msg = $item->text;
                        $permalink = 'http://twitter.com/#!/' . $twitter_username . '/status/' . $item->id_str;
                        if ($encode_utf8) {
                            $msg = utf8_encode($msg);
                        }
                        $link = $permalink;
                        echo '<div class="twitter-list"><div class="row">';
                        echo '<div class="col-xs-2 col-sm-2 col-md-2 col-lg-2">
										<div class="twitter-feed-icon text-center">
											<i class="fa fa-twitter fa-2x"></i>
										</div>
									</div>';
                        if ($hyperlinks) {
                            $msg = $this->hyperlinks($msg);
                        }
                        if ($twitter_users) {
                            $msg = $this->twitter_users($msg);
                        }
                        echo '<div class="col-xs-10 col-sm-10 col-md-10 col-lg-10">';
                        echo '<p>';
                        echo $msg;
                        echo '</p>';
                        if ($update) {
                            $time = strtotime($item->created_at);
                            if (abs(time() - $time) < 1814400) {
                                $h_time = sprintf(esc_html('%s ago'), human_time_diff($time));
                            } else {
                                $h_time = date(esc_html('Y/m/d'), $time);
                            }
                            echo sprintf(esc_html('%s', 'twitter-for-wordpress'), ' <ul class="list-inline post-meta twitter-meta"><li class="post-date"><abbr title="' . date(esc_html('Y/m/d H:i:s'), $time) . '">' . $h_time . '</abbr></li></ul>');
                        }
                        echo '</div>';
                        echo '</div></div>';
                        $i++;
                        if ($i >= $no_of_tweets) {
                            break;
                        }
                    }
                } else {
                    $unique_key = fave_unique_key();
                    if (is_rtl()) {
                        $magzilla_rtl = 'true';
                    } else {
                        $magzilla_rtl = 'false';
                    }
                    ?>

							<script type="text/javascript">
							jQuery(document).ready(function($) {

								$("#owl-twitter-<?php 
                    echo $unique_key;
                    ?>
").owlCarousel({
									rtl: <?php 
                    echo $magzilla_rtl;
                    ?>
,
									loop: true,
									touchDrag: true,
									items : 1,

								    //Autoplay
								    autoplay : true,
									autoplayHoverPause : true,

								    // Navigation
									nav : true,
									navText : ["<i class='fa fa-chevron-left'></i>","<i class='fa fa-chevron-right'></i>"],
								    rewindNav : true,
								    dots:false,

								    // Responsive
									responsiveClass:true,
									responsiveRefreshRate : 200,
									responsiveBaseWidth: window,

								    //Lazy load
								    lazyLoad : true,
								    lazyFollow : true,
								    lazyEffect : "fade",
								});

							});
							</script>
						<?php 
                    echo '<div id="owl-twitter-' . $unique_key . '" class="owl-carousel">';
                    foreach ($twitterData as $item) {
                        $msg = $item->text;
                        $permalink = 'http://twitter.com/#!/' . $twitter_username . '/status/' . $item->id_str;
                        if ($encode_utf8) {
                            $msg = utf8_encode($msg);
                        }
                        $link = $permalink;
                        echo '<div class="slide"><div class="twitter-carousel">';
                        echo '<div class="twitter-feed-icon text-center">
										<i class="fa fa-twitter fa-2x"></i>
								  </div>';
                        if ($hyperlinks) {
                            $msg = $this->hyperlinks($msg);
                        }
                        if ($twitter_users) {
                            $msg = $this->twitter_users($msg);
                        }
                        echo '<div class="twitter-feed-copy text-center">';
                        echo '<p>';
                        echo $msg;
                        echo '</p>';
                        if ($update) {
                            $time = strtotime($item->created_at);
                            if (abs(time() - $time) < 1814400) {
                                $h_time = sprintf(esc_html('%s ago'), human_time_diff($time));
                            } else {
                                $h_time = date(esc_html('Y/m/d'), $time);
                            }
                            echo sprintf(esc_html('%s', 'twitter-for-wordpress'), ' <ul class="list-inline post-meta twitter-meta"><li class="post-date"><abbr title="' . date(esc_html('Y/m/d H:i:s'), $time) . '">' . $h_time . '</abbr></li></ul>');
                        }
                        echo '</div>';
                        echo '</div></div>';
                        $i++;
                        if ($i >= $no_of_tweets) {
                            break;
                        }
                    }
                    echo '</div>';
                }
                echo '</div>';
            } else {
                ?>
 <a href="http://twitter.com/<?php 
                echo $twitter_username;
                ?>
"><?php 
                echo $title;
                ?>
</a> 
<?php 
            }
            ?>
		<?php 
            /* After widget (defined by themes). */
            echo $after_widget;
        } else {
            echo $before_widget;
            echo $before_title;
            ?>
			<a href="http://twitter.com/<?php 
            echo $twitter_username;
            ?>
"><?php 
            echo $title;
            ?>
</a>
		<?php 
            echo $after_title;
            echo 'Setup Twitter API OAuth settings for widget ';
            echo $after_widget;
        }
    }
Exemplo n.º 9
0
    /** @see WP_Widget::widget */
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $userid = apply_filters('userid', $instance['userid']);
        $accessToken = apply_filters('accessToken', $instance['accessToken']);
        $link_to = isset($instance['images_link']) ? $instance['images_link'] : 'image_url';
        $amount = isset($instance['images_number']) ? $instance['images_number'] : 5;
        $template = isset($instance['template']) ? $instance['template'] : 'slider';
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        ?>
                 

<?php 
        // Pulls and parses data.
        $result = $this->fetchData('https://api.instagram.com/v1/users/' . $userid . '/media/recent/?access_token=' . $accessToken . '&count=' . $amount);
        $result = json_decode($result);
        $unique_key = fave_unique_key();
        if (is_rtl()) {
            $magzilla_rtl = 'true';
        } else {
            $magzilla_rtl = 'false';
        }
        ?>
			
			<script type="text/javascript">
			jQuery(document).ready(function($) { 
				
				$("#owl-carousel-instagram-<?php 
        echo $unique_key;
        ?>
").owlCarousel({
					rtl: <?php 
        echo $magzilla_rtl;
        ?>
,
					loop: true,
					touchDrag: true,
					items : 1,

				    //Autoplay
				    autoplay : true,
					autoplayHoverPause : true,

				    // Navigation
					nav : true,
					navText : ["<i class='fa fa-chevron-left'></i>","<i class='fa fa-chevron-right'></i>"],
				    rewindNav : true,
				    dots:false,

				    // Responsive 
					responsiveClass:true,
					responsiveRefreshRate : 200,
					responsiveBaseWidth: window,

				    //Lazy load
				    lazyLoad : true,
				    lazyFollow : true,
				    lazyEffect : "fade",
				});
				
			});
			</script>
		<?php 
        //include the template based on user choice
        if (!empty($result->data)) {
            if ($template == "slider") {
                $this->magazilla_instagram_slider($template, $result, $link_to, $unique_key);
            } else {
                $this->magazilla_instagram_slider_thumbs($template, $result, $link_to);
            }
        }
        ?>

								
<?php 
        echo $after_widget;
        ?>
			 
<?php 
    }