Пример #1
0
function fav_module_7($atts, $content = null)
{
    extract(shortcode_atts(array('module_7_type' => '', 'category_id' => '', 'category_ids' => '', 'tag_slug' => '', 'sort' => '', 'autors_id' => '', 'posts_limit' => '', 'offset' => '', 'header_color' => '', 'header_text_color' => '', 'header_border_color' => '', 'custom_title' => '', 'custom_url' => '', 'hide_title' => '', 'title_style' => '', 'show_child_cat' => '', 'image_size' => '', 'module_space' => '', 'module_meta' => '', 'author_name' => '', 'time_diff' => '', 'post_date' => '', 'post_time' => '', 'post_view_count' => '', 'post_comment_count' => '', 'text_align' => '', 'module_bg' => '', 'module_padding' => ''), $atts));
    ob_start();
    if ($module_7_type == "two_columns") {
        $css_classes = "col-lg-6 col-md-6 col-sm-6 col-xs-6";
        $columns_class = "module-7-two-cols";
    } elseif ($module_7_type == "one_columns") {
        $css_classes = "col-lg-12 col-md-12 col-sm-12 col-xs-12";
        $columns_class = "module-7-one-cols";
    } else {
        $css_classes = "col-lg-4 col-md-4 col-sm-6 col-xs-6";
        $columns_class = "module-7-three-cols";
    }
    if ($image_size == '570_427') {
        $img_width = '570';
        $img_height = '427';
    } else {
        $img_width = '370';
        $img_height = '277';
    }
    $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
    $the_query = fave_data_source::get_wp_query($atts);
    //by ref  do the query
    ?>
	
	<div class="module module-7 <?php 
    echo esc_attr($columns_class . ' ' . $text_align);
    ?>
 gallery-4" <?php 
    echo $style;
    ?>
>
		<?php 
    if ($hide_title != 'hide_title') {
        ?>
		<div class="row">
			<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
				<div class="module-top clearfix">
					<?php 
        //get the block title
        echo fave_get_block_title($atts);
        //get the sub category filter for this block
        echo fave_get_block_sub_cats($atts);
        ?>
				</div><!-- .module-top -->
			</div><!-- col-lg-12 col-md-12 col-sm-12 col-xs-12 -->
		</div><!-- .row -->
		<?php 
    }
    ?>

		<div class="row <?php 
    if (!empty($module_space)) {
        echo $module_space;
    }
    ?>
">
			<?php 
    while ($the_query->have_posts()) {
        $the_query->the_post();
        ?>
			<div <?php 
        post_class($css_classes);
        ?>
 <?php 
        echo fave_get_item_scope();
        ?>
>
				<div class="thumb big-thumb">
					<a itemprop="url" href="<?php 
        echo esc_url(get_permalink());
        ?>
"></a>
					<div class="thumb-content">
						<h2 itemprop="headline" class="gallery-title-small"><a itemprop="url" href="<?php 
        echo esc_url(get_permalink());
        ?>
"><?php 
        the_title();
        ?>
</a></h2>
						<ul class="list-inline post-meta hidden-xs hidden-sm hidden-md">
							<?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 slider-with-animation">
						<?php 
        get_template_part('inc/article', 'icon');
        ?>
						<img itemprop="image" class="featured-image" width="<?php 
        echo $img_width;
        ?>
" height="<?php 
        echo $img_height;
        ?>
" src="<?php 
        echo fave_featured_image(get_the_ID(), $img_width, $img_height, true, true, true);
        ?>
" alt="<?php 
        the_title();
        ?>
">
					</div><!-- slide-image-wrap -->
				</div><!-- thumb -->
			</div><!-- col-lg-4 col-md-4 col-sm-6 col-xs-6 -->				
			<?php 
    }
    ?>
	    </div><!-- row -->
	</div><!-- .module-7 -->

	<?php 
    $result = ob_get_contents();
    ob_end_clean();
    return $result;
}
Пример #2
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;
}
Пример #3
0
function fav_module_9($atts, $content = null)
{
    extract(shortcode_atts(array('module_9_type' => '', 'category_id' => '', 'category_ids' => '', 'tag_slug' => '', 'sort' => '', 'autors_id' => '', 'posts_limit' => '', 'offset' => '', 'header_color' => '', 'header_text_color' => '', 'header_border_color' => '', 'custom_title' => '', 'custom_url' => '', 'hide_title' => '', 'title_style' => '', 'module_space' => '', 'module_meta' => '', 'author_name' => '', 'time_diff' => '', 'post_date' => '', 'post_time' => '', 'post_view_count' => '', 'post_comment_count' => '', 'module_bg' => '', 'module_padding' => ''), $atts));
    ob_start();
    $css_class_3 = '';
    if ($module_9_type == "sidebar_template") {
        $css_class_1 = "col-lg-9 col-md-9 col-sm-12 col-xs-12";
        $css_class_2 = "col-lg-3 col-md-3 col-sm-12 col-xs-12";
        $css_class_3 = "with-sidebar";
        $image_1_width = '570';
        $image_1_height = '354';
        $image_2_width = '170';
        $image_2_height = '103';
    } else {
        $css_class_1 = "col-lg-6 col-md-6 col-sm-12 col-xs-12";
        $css_class_2 = "col-lg-2 col-md-2 col-sm-12 col-xs-12";
        $image_1_width = '570';
        $image_1_height = '428';
        $image_2_width = '170';
        $image_2_height = '125';
    }
    $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
    $the_query = fave_data_source::get_wp_query($atts);
    //by ref  do the query
    ?>
	

	<div class="module-9 module gallery" <?php 
    echo $style;
    ?>
>
		
		<?php 
    if ($hide_title != 'hide_title') {
        ?>
		<div class="row">
			<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
				<div class="module-top clearfix">
					
					<?php 
        //get the block title
        echo fave_get_block_title($atts);
        ?>

				</div><!-- .module-top -->
			</div><!-- col-lg-12 col-md-12 col-sm-12 col-xs-12 -->
		</div><!-- .row -->
		<?php 
    }
    ?>


		<div class="row <?php 
    if (!empty($module_space)) {
        echo $module_space;
    }
    ?>
">
			
			<?php 
    $count = 0;
    while ($the_query->have_posts()) {
        $the_query->the_post();
        $count++;
        ?>
			<div <?php 
        post_class($css_class_1);
        ?>
 <?php 
        echo fave_get_item_scope();
        ?>
>
				<div class="thumb big-thumb <?php 
        echo esc_attr($css_class_3);
        ?>
">
					<a href="<?php 
        echo esc_url(get_permalink());
        ?>
"></a>
					<div class="thumb-content">
						<h2 itemprop="headline" class="gallery-title-small"><a itemprop="url" href="<?php 
        echo esc_url(get_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 slider-with-animation">
						<?php 
        get_template_part('inc/article', 'icon');
        ?>
						<img itemprop="image" class="featured-image" width="<?php 
        echo $image_1_width;
        ?>
" height="<?php 
        echo $image_1_height;
        ?>
" src="<?php 
        echo fave_featured_image(get_the_ID(), $image_1_width, $image_1_height, true, true, true);
        ?>
" alt="<?php 
        the_title();
        ?>
">
					</div><!-- slide-image-wrap -->
				</div><!-- thumb -->
			</div>
				
			<?php 
        if ($count == 1) {
            break;
        }
    }
    ?>
			
			
			<?php 
    $total_posts = $the_query->post_count;
    $loop = $post_counter = 0;
    ?>

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

			<?php 
        if ($loop == 1) {
            ?>
			<div class="<?php 
            echo esc_attr($css_class_2);
            ?>
">
			<?php 
        }
        ?>

				<div <?php 
        post_class('thumb small-thumb');
        ?>
 <?php 
        echo fave_get_item_scope();
        ?>
 >
					<a href="<?php 
        echo esc_url(get_permalink());
        ?>
"></a>
					<div class="thumb-content">
						<h2 itemprop="headline" class="gallery-title-small"><a itemprop="url" href="<?php 
        echo esc_url(get_permalink());
        ?>
"><?php 
        the_title();
        ?>
</a></h2>
						<meta content="<?php 
        the_time('Y-m-d ');
        ?>
" itemprop="datePublished">
					</div>

					<div class="slide-image-wrap slider-with-animation">
						<?php 
        get_template_part('inc/article', 'icon');
        ?>
						<img itemprop="image" class="featured-image" width="<?php 
        echo $image_2_width;
        ?>
" height="<?php 
        echo $image_2_height;
        ?>
" src="<?php 
        echo fave_featured_image(get_the_ID(), $image_2_width, $image_2_height, true, true, true);
        ?>
" alt="<?php 
        the_title();
        ?>
">
					</div><!-- slide-image-wrap -->
				</div><!-- thumb -->
			
			<?php 
        if ($loop == 3 || $post_counter == $total_posts - 1) {
            $loop = 0;
            ?>
	
			</div>
			<?php 
        }
        ?>

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

		</div><!-- .row -->
	</div><!-- .module-9 -->
    

	<?php 
    $result = ob_get_contents();
    ob_end_clean();
    return $result;
}
Пример #4
0
function fav_module_6($atts, $content = null)
{
    extract(shortcode_atts(array('category_id' => '', 'category_ids' => '', 'tag_slug' => '', 'sort' => '', 'autors_id' => '', 'posts_limit' => '', 'offset' => '', 'header_color' => '', 'header_text_color' => '', 'header_border_color' => '', 'custom_title' => '', 'custom_url' => '', 'hide_title' => '', 'title_style' => '', 'show_child_cat' => '', 'excerpt_limit' => '', 'image_size' => '', 'read_more' => '', 'module_meta' => '', 'author_name' => '', 'time_diff' => '', 'post_date' => '', 'post_time' => '', 'post_view_count' => '', 'post_comment_count' => '', 'module_bg' => '', 'module_padding' => ''), $atts));
    ob_start();
    //do the query
    $the_query = fave_data_source::get_wp_query($atts);
    //by ref  do the query
    if ($image_size == '570_427') {
        $img_width = '570';
        $img_height = '427';
    } else {
        $img_width = '370';
        $img_height = '277';
    }
    $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="module-6 module" <?php 
    echo $style;
    ?>
>
		
		<?php 
    if ($hide_title != 'hide_title') {
        ?>
		<div class="row">
			<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
				<div class="module-top clearfix">
					
					<?php 
        //get the block title
        echo fave_get_block_title($atts);
        //get the sub category filter for this block
        echo fave_get_block_sub_cats($atts);
        ?>

				</div><!-- .module-top -->
			</div><!-- col-lg-12 col-md-12 col-sm-12 col-xs-12 -->
		</div><!-- .row -->
		<?php 
    }
    ?>

			
		<?php 
    while ($the_query->have_posts()) {
        $the_query->the_post();
        $categories = get_the_category(get_the_ID());
        $cats_html = '';
        if ($categories) {
            foreach ($categories as $category) {
                $cat_id = $category->cat_ID;
                $cat_link = get_category_link($cat_id);
                $cats_html .= '<a class="cat-color-' . $cat_id . '" href="' . esc_url($cat_link) . '">' . esc_html($category->name) . '</a>';
            }
        }
        ?>
			
			
			<div <?php 
        post_class('row');
        ?>
 <?php 
        echo fave_get_item_scope();
        ?>
>
				
				<?php 
        if (has_post_thumbnail()) {
            ?>
				<div class="col-lg-6 col-md-6 col-sm-5 col-xs-5">
					<div class="featured-image-wrap">
						<?php 
            get_template_part('inc/article', 'icon');
            ?>
						
						<a href="<?php 
            echo esc_url(get_permalink());
            ?>
">
							<img itemprop="image" class="featured-image" width="<?php 
            echo $img_width;
            ?>
" height="<?php 
            echo $img_height;
            ?>
" src="<?php 
            echo fave_featured_image(get_the_ID(), $img_width, $img_height, true, true, true);
            ?>
" alt="<?php 
            the_title();
            ?>
">
						</a>
						
					</div><!-- featured-image-wrap -->
				</div><!-- col-lg-6 col-md-6 col-sm-5 col-xs-5 -->
				<?php 
        }
        ?>

				<div class="col-lg-6 col-md-6 col-sm-7 col-xs-7">
					<article>
						<div class="category-label-wrap">
							<div class="category-label"><?php 
        echo $cats_html;
        ?>
</div>
						</div><!-- category-label-wrap -->
						
						<h2 itemprop="headline" class="post-title module-big-title"><a itemprop="url" href="<?php 
        echo esc_url(get_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 class="post-content post-small-content"  itemprop="articleBody"><p><?php 
        echo fave_clean_excerpt($excerpt_limit, $read_more);
        ?>
</p></div><!-- post-content -->

					</article><!-- .module-6-post -->
				</div><!-- col-lg-6 col-md-6 col-sm-7 col-xs-7 -->
			</div><!-- .row -->

		
		<?php 
    }
    ?>
			
	</div><!-- .module-6 -->
    

	<?php 
    $result = ob_get_contents();
    ob_end_clean();
    return $result;
}
Пример #5
0
function fav_grids($atts, $content = null)
{
    extract(shortcode_atts(array('grid_type' => '', 'post_from' => '', 'category_id' => '', 'category_ids' => '', 'hide_meta' => '', 'hide_cat' => '', 'sort' => '', 'posts_limit' => '', '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);
    ?>

       

<?php 
    if ($grid_type == "grid_1") {
        ?>

<div class="grid-banner magzilla-grid-1" <?php 
        echo $style;
        ?>
>
		
		<div class="row row-no-padding">

		<?php 
        $i = 0;
        ?>
		<?php 
        while ($the_query->have_posts()) {
            $the_query->the_post();
            $i++;
            if ($i == 1 || $i == 6) {
                $grid_classes = "col-lg-6 col-md-6 col-sm-6 col-xs-12 grid-1-big";
                $img_width = '585';
                $img_height = '285';
                if (has_post_thumbnail()) {
                    $featured_image = fave_featured_image(get_the_ID(), 585, 285, true, true, true);
                } else {
                    $featured_image = 'http://placehold.it/585x284';
                }
            } else {
                $grid_classes = "col-lg-3 col-md-3 col-sm-3 col-xs-6 grid-1-small";
                $img_width = '290';
                $img_height = '285';
                if (has_post_thumbnail()) {
                    $featured_image = fave_featured_image(get_the_ID(), 290, 285, true, true, true);
                } else {
                    $featured_image = 'http://placehold.it/293x285';
                }
            }
            if ($i == 6) {
                $i = 0;
            }
            ?>
 	
			<div class="<?php 
            echo esc_attr($grid_classes);
            ?>
">
				
				<div <?php 
            post_class('thumb');
            ?>
 <?php 
            echo fave_get_item_scope();
            ?>
>
					<a href="<?php 
            the_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
"></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>
						
						<?php 
            if ($hide_meta != 'no') {
                ?>
						<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 -->
						<?php 
            }
            ?>

					</div>
					<?php 
            if (has_post_thumbnail()) {
                ?>
					<div class="slide-image-wrap">
						<?php 
                get_template_part('inc/article', 'icon');
                ?>
						
						<img itemprop="image" class="featured-image lazyOwl" width="<?php 
                echo $img_width;
                ?>
" height="<?php 
                echo $img_height;
                ?>
" data-src="<?php 
                echo $featured_image;
                ?>
" src="<?php 
                echo $featured_image;
                ?>
" alt="<?php 
                the_title();
                ?>
">
						
					</div><!-- slide-image-wrap -->
					<?php 
            }
            ?>

				</div>
			</div>
			

		<?php 
        }
        ?>

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

<?php 
    } elseif ($grid_type == "grid_2") {
        ?>

		<div class="grid-banner magzilla-grid-2" <?php 
        echo $style;
        ?>
>
		
				<div class="row row-no-padding">

				<?php 
        $i = 0;
        ?>
				<?php 
        while ($the_query->have_posts()) {
            $the_query->the_post();
            $i++;
            if ($i == 1 || $i == 2) {
                $grid_classes = "col-lg-6 col-md-6 col-sm-12 col-xs-12 grid-2-big";
                $img_width = '585';
                $img_height = '285';
                if (has_post_thumbnail()) {
                    $featured_image = fave_featured_image(get_the_ID(), 585, 285, true, true, true);
                } else {
                    $featured_image = 'http://placehold.it/720x350';
                }
            } else {
                $grid_classes = "col-lg-3 col-md-3 col-sm-6 col-xs-12 grid-2-small";
                $img_width = '293';
                $img_height = '285';
                if (has_post_thumbnail()) {
                    $featured_image = fave_featured_image(get_the_ID(), 293, 285, true, true, true);
                } else {
                    $featured_image = 'http://placehold.it/450x438';
                }
            }
            if ($i == 6) {
                $i = 0;
            }
            ?>
 	
					<div class="<?php 
            echo esc_attr($grid_classes);
            ?>
">
						
						<div <?php 
            post_class('thumb');
            ?>
 <?php 
            echo fave_get_item_scope();
            ?>
>
							<a href="<?php 
            the_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
"></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>
								
								<?php 
            if ($hide_meta != 'no') {
                ?>
								<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 -->
								<?php 
            }
            ?>
								
							</div>
							<?php 
            if (has_post_thumbnail()) {
                ?>
							<div class="slide-image-wrap">
								<?php 
                get_template_part('inc/article', 'icon');
                ?>
								
								<img itemprop="image" class="featured-image lazyOwl" width="<?php 
                echo $img_width;
                ?>
" height="<?php 
                echo $img_height;
                ?>
" data-src="<?php 
                echo $featured_image;
                ?>
" src="<?php 
                echo $featured_image;
                ?>
" alt="<?php 
                the_title();
                ?>
">
								
							</div><!-- slide-image-wrap -->
							<?php 
            }
            ?>

						</div>
					</div>
					

				<?php 
        }
        ?>

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

<?php 
    }
    ?>

<?php 
    $result = ob_get_contents();
    ob_end_clean();
    return $result;
}
Пример #6
0
function fav_module_8($atts, $content = null)
{
    extract(shortcode_atts(array('category_id' => '', 'category_ids' => '', 'tag_slug' => '', 'sort' => '', 'autors_id' => '', 'posts_limit' => '', 'offset' => '', 'header_color' => '', 'header_text_color' => '', 'header_border_color' => '', 'custom_title' => '', 'custom_url' => '', 'hide_title' => '', 'hide_meta' => '', 'title_style' => '', 'slider_post_row' => '', 'slider_auto' => '', 'stop_on_hover' => '', 'navigation' => '', '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' => '', 'text_align' => '', 'module_bg' => '', 'module_padding' => ''), $atts));
    ob_start();
    $rnr_id = fave_element_key();
    if (is_rtl()) {
        $magzilla_rtl = 'true';
    } else {
        $magzilla_rtl = 'false';
    }
    ?>
	<script>
	jQuery(document).ready(function($) {

		// Gallery 1 with sidebar
		$("#favethemes-carousel-<?php 
    echo $rnr_id;
    ?>
").owlCarousel({
			rtl: <?php 
    echo $magzilla_rtl;
    ?>
,
			loop: <?php 
    echo $slide_loop;
    ?>
,
			touchDrag: <?php 
    echo $touch_drag;
    ?>
,

			responsive:{
				0:{
					items:2
				},
				479:{
					items:2
				},
				768:{
					items:3
				},
				980:{
					items:3
				},
				1199:{
					items:<?php 
    echo $slider_post_row;
    ?>
				}
			},

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

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

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

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

	</script>
	<?php 
    //do the query
    $the_query = fave_data_source::get_wp_query($atts);
    if ($slider_post_row == '1') {
        $img_width = '1170';
        $img_height = '658';
        $title_custom_class = "title-cols-1";
    } elseif ($slider_post_row == '2') {
        $img_width = '570';
        $img_height = '427';
        $title_custom_class = "title-cols-2";
    } elseif ($slider_post_row == '3') {
        $img_width = '570';
        $img_height = '428';
        $title_custom_class = "title-cols-3";
    } else {
        $img_width = '370';
        $img_height = '278';
        $title_custom_class = "title-cols-4";
    }
    if ($slider_post_row == '2') {
        $column_class = "module-8-two-cols ";
    } elseif ($slider_post_row == '3') {
        $column_class = "module-8-three-cols ";
    } elseif ($slider_post_row == '4') {
        $column_class = "module-8-four-cols ";
    } elseif ($slider_post_row == '5') {
        $column_class = "module-8-five-cols ";
    } elseif ($slider_post_row == '6') {
        $column_class = "module-8-six-cols ";
    }
    $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="module-8 <?php 
    echo esc_attr($column_class . ' ' . $text_align);
    ?>
 gallery" <?php 
    echo $style;
    ?>
>
		<?php 
    if ($hide_title != 'hide_title') {
        ?>
		<div class="row">
			<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
				<div class="module-top clearfix">
					<?php 
        //get the block title
        echo fave_get_block_title($atts);
        ?>
				</div><!-- .module-top -->
			</div><!-- col-lg-12 col-md-12 col-sm-12 col-xs-12 -->
		</div><!-- .row -->
		<?php 
    }
    ?>

		<div class="row">			
			<div id="favethemes-carousel-<?php 
    echo esc_attr($rnr_id);
    ?>
" class="owl-carousel">
				<?php 
    while ($the_query->have_posts()) {
        $the_query->the_post();
        ?>
				<div <?php 
        post_class('slide');
        ?>
 <?php 
        echo fave_get_item_scope();
        ?>
>
					<div class="slide-image-wrap slider-with-animation">
						<?php 
        get_template_part('inc/article', 'icon');
        ?>
						<a href="<?php 
        echo esc_url(get_permalink());
        ?>
">
							<img itemprop="image" class="featured-image lazyOwl" data-src="<?php 
        echo fave_featured_image(get_the_ID(), $img_width, $img_height, true, true, true);
        ?>
" src="<?php 
        echo fave_featured_image(get_the_ID(), $img_width, $img_height, true, true, true);
        ?>
" alt="<?php 
        the_title();
        ?>
">
						</a>
					</div><!-- slide-image-wrap -->
					<h2 itemprop="headline" class="gallery-title-small <?php 
        echo esc_attr($title_custom_class);
        ?>
"><a itemprop="url" href="<?php 
        echo esc_url(get_permalink());
        ?>
"><?php 
        the_title();
        ?>
</a></h2>
					<?php 
        if ($hide_meta != 'hide_meta') {
            ?>
					<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 -->
					<?php 
        }
        ?>
				</div><!-- slide -->
				<?php 
    }
    wp_reset_postdata();
    ?>
						
			</div><!-- owl-carousel -->
	    </div><!-- row -->
	</div><!-- .module-8 -->

	<?php 
    $result = ob_get_contents();
    ob_end_clean();
    return $result;
}