Пример #1
0
        function get_tab_content($instance, $posts)
        {
            global $post;
            $show_thumbnail = empty($instance['show_thumbnail']) ? 0 : $instance['show_thumbnail'];
            $show_title = empty($instance['show_title']) ? 0 : $instance['show_title'];
            $show_date = empty($instance['show_date']) ? 0 : $instance['show_date'];
            $show_author = empty($instance['show_author']) ? 0 : $instance['show_author'];
            $show_comment = empty($instance['show_comment']) ? 0 : $instance['show_comment'];
            $show_excerpt = empty($instance['show_excerpt']) ? 0 : $instance['show_excerpt'];
            $excerpt_words = absint($instance['excerpt_words']);
            $extra_class = '';
            $extra_class .= $show_thumbnail ? ' has-image' : ' no-image';
            ?>
			<ul class="post_list_widget <?php 
            echo esc_attr($extra_class);
            ?>
">
			<?php 
            while ($posts->have_posts()) {
                $posts->the_post();
                ?>
					
						<li>
							<?php 
                if ($show_thumbnail) {
                    ?>
							<a class="thumbnail" href="<?php 
                    the_permalink();
                    ?>
">
								<figure>
									<?php 
                    if (has_post_thumbnail()) {
                        the_post_thumbnail('ts_blog_shortcode_thumb');
                    } else {
                        ?>
										<img title="noimage" src="<?php 
                        echo get_template_directory_uri();
                        ?>
/images/no-image-blog.jpg" alt="<?php 
                        echo esc_attr(get_the_title());
                        ?>
" />
										<?php 
                    }
                    ?>
								</figure>
								<div class="effect-thumbnail"></div>
							</a>
							<?php 
                }
                ?>
							
							<div class="blog-info">
								<?php 
                if ($show_title) {
                    ?>
								<a href="<?php 
                    the_permalink();
                    ?>
" class="post-title">
									<?php 
                    the_title();
                    ?>
								</a>
								<?php 
                }
                ?>
								
								<?php 
                if ($show_excerpt) {
                    ?>
									<div class="excerpt">
										<?php 
                    ts_the_excerpt_max_words($excerpt_words, $post);
                    ?>
									</div>
								<?php 
                }
                ?>
								
								<?php 
                if ($show_date || $show_author || $show_comment) {
                    ?>
								<div class="post-meta">
								
									<?php 
                    if ($show_date) {
                        ?>
									<span class="date-time">
										<i class="fa fa-calendar"></i>
										<?php 
                        the_time(get_option('date_format'));
                        ?>
									</span>
									<?php 
                    }
                    ?>
									
									<?php 
                    if ($show_author) {
                        ?>
									<span class="author">
										<i class="fa fa-user"></i>
										<?php 
                        the_author_posts_link();
                        ?>
									</span>
									<?php 
                    }
                    ?>
									
									<?php 
                    if ($show_comment) {
                        ?>
									<span class="comment">
										<i class="fa fa-comments-o"></i>
										<span class="comment-number"><?php 
                        echo get_comments_number();
                        ?>
</span>
									</span>
									<?php 
                    }
                    ?>
								</div>
								<?php 
                }
                ?>
							</div>
						</li>
				<?php 
            }
            ?>
			</ul>
			<?php 
        }
Пример #2
0
        function widget($args, $instance)
        {
            extract($args);
            $title = apply_filters('widget_title', $instance['title']);
            $limit = $instance['limit'] != 0 ? absint($instance['limit']) : 4;
            $order = $instance['order'];
            $orderby = $instance['orderby'];
            $categories = isset($instance['categories']) ? (array) $instance['categories'] : array();
            $show_thumbnail = empty($instance['show_thumbnail']) ? 0 : $instance['show_thumbnail'];
            $show_title = empty($instance['show_title']) ? 0 : $instance['show_title'];
            $show_date = empty($instance['show_date']) ? 0 : $instance['show_date'];
            $show_author = empty($instance['show_author']) ? 0 : $instance['show_author'];
            $show_comment = empty($instance['show_comment']) ? 0 : $instance['show_comment'];
            $show_excerpt = empty($instance['show_excerpt']) ? 0 : $instance['show_excerpt'];
            $excerpt_words = absint($instance['excerpt_words']);
            $is_slider = empty($instance['is_slider']) ? 0 : $instance['is_slider'];
            $row = $instance['row'] != 0 ? absint($instance['row']) : 2;
            $show_nav = empty($instance['show_nav']) ? 0 : $instance['show_nav'];
            $auto_play = empty($instance['auto_play']) ? 0 : $instance['auto_play'];
            echo $before_widget;
            if ($title) {
                echo $before_title . $title . $after_title;
            }
            $args = array('post_type' => 'post', 'ignore_sticky_posts' => 1, 'post_status' => 'publish', 'posts_per_page' => $limit, 'order' => $order, 'orderby' => $orderby);
            if (is_array($categories) && count($categories) > 0) {
                $args['category__in'] = $categories;
            }
            global $post;
            $posts = new WP_Query($args);
            if ($posts->have_posts()) {
                $count = 0;
                $num_posts = $posts->post_count;
                if ($num_posts <= $row) {
                    $is_slider = false;
                }
                if (!$is_slider) {
                    $row = $num_posts;
                }
                $extra_class = '';
                $extra_class .= $is_slider ? 'ts-slider loading' : '';
                $extra_class .= $is_slider && $show_nav ? ' has-navi' : '';
                $extra_class .= $show_thumbnail ? ' has-image' : ' no-image';
                ?>
				<div class="ts-blogs-widget-wrapper <?php 
                echo esc_attr($extra_class);
                ?>
" data-show_nav="<?php 
                echo esc_attr($show_nav);
                ?>
" data-auto_play="<?php 
                echo esc_attr($auto_play);
                ?>
">
					<?php 
                while ($posts->have_posts()) {
                    $posts->the_post();
                    $post_format = get_post_format();
                    /* Video, Audio, Gallery, Quote */
                    if ($is_slider && $post_format == 'gallery') {
                        /* Remove Slider in Slider */
                        $post_format = false;
                    }
                    ?>
						<?php 
                    if ($count % $row == 0) {
                        ?>
						<div class="per-slide">
							<ul class="post_list_widget">
						<?php 
                    }
                    ?>
							<li>
								<?php 
                    if ($show_thumbnail) {
                        ?>
									<?php 
                        if ($post_format == 'gallery' || $post_format === false || $post_format == 'standard') {
                            ?>
										<a class="thumbnail <?php 
                            echo esc_attr($post_format);
                            echo $post_format == 'gallery' ? ' loading' : '';
                            ?>
" href="<?php 
                            the_permalink();
                            ?>
">
											<figure>
												<?php 
                            if ($post_format == 'gallery') {
                                $gallery = get_post_meta($post->ID, 'ts_gallery', true);
                                $gallery_ids = explode(',', $gallery);
                                if (is_array($gallery_ids) && has_post_thumbnail()) {
                                    array_unshift($gallery_ids, get_post_thumbnail_id());
                                }
                                foreach ($gallery_ids as $gallery_id) {
                                    echo wp_get_attachment_image($gallery_id, 'ts_blog_shortcode_thumb');
                                }
                            }
                            if ($post_format === false || $post_format == 'standard') {
                                if (has_post_thumbnail()) {
                                    the_post_thumbnail('ts_blog_shortcode_thumb');
                                } else {
                                    ?>
														<img title="noimage" src="<?php 
                                    echo get_template_directory_uri();
                                    ?>
/images/no-image-blog.jpg" alt="<?php 
                                    echo esc_attr(get_the_title());
                                    ?>
" />
														<?php 
                                }
                            }
                            ?>
											</figure>
											<div class="effect-thumbnail"></div>
										</a>
									<?php 
                        }
                        if ($post_format == 'video') {
                            $video_url = get_post_meta($post->ID, 'ts_video_url', true);
                            echo do_shortcode('[ts_video src="' . $video_url . '"]');
                        }
                        if ($post_format == 'audio') {
                            $audio_url = get_post_meta($post->ID, 'ts_audio_url', true);
                            if (strlen($audio_url) > 4) {
                                $file_format = substr($audio_url, -3, 3);
                                if (in_array($file_format, array('mp3', 'ogg', 'wav'))) {
                                    echo do_shortcode('[audio ' . $file_format . '="' . $audio_url . '"]');
                                } else {
                                    echo do_shortcode('[ts_soundcloud url="' . $audio_url . '" width="100%" height="122"]');
                                }
                            }
                        }
                        ?>
								<?php 
                    }
                    /* End thumbnail */
                    ?>
								
								<?php 
                    if ($post_format != 'quote') {
                        ?>
								
									<?php 
                        if ($show_date && !$show_thumbnail) {
                            ?>
									<div class="post-date">
										<span class="day">
											<?php 
                            echo get_the_time('d');
                            ?>
										</span>
										<span class="month">
											<?php 
                            echo get_the_time('M');
                            ?>
										</span>
									</div>
									<?php 
                        }
                        ?>
									
									<?php 
                        if ($show_title) {
                            ?>
									<a href="<?php 
                            the_permalink();
                            ?>
" class="post-title">
										<?php 
                            the_title();
                            ?>
									</a>
									<?php 
                        }
                        ?>
									
									<?php 
                        if ($show_excerpt) {
                            ?>
										<div class="excerpt">
											<?php 
                            ts_the_excerpt_max_words($excerpt_words, $post);
                            ?>
										</div>
									<?php 
                        }
                        ?>
									
									<?php 
                        if ($show_date && $show_thumbnail || $show_author || $show_comment) {
                            ?>
									<div class="post-meta">
									
										<?php 
                            if ($show_date && $show_thumbnail) {
                                ?>
										<span class="date-time">
											<i class="fa fa-calendar"></i>
											<?php 
                                the_time(get_option('date_format'));
                                ?>
										</span>
										<?php 
                            }
                            ?>
										
										<?php 
                            if ($show_comment) {
                                ?>
										<span class="comment">
											<i class="fa fa-comments-o"></i>
											<span class="comment-number"><?php 
                                echo get_comments_number();
                                ?>
</span>
										</span>
										<?php 
                            }
                            ?>
										
										<?php 
                            if ($show_author) {
                                ?>
										<span class="author">
											<i class="fa fa-user"></i>
											<?php 
                                the_author_posts_link();
                                ?>
										</span>
										<?php 
                            }
                            ?>
									</div>
									<?php 
                        }
                        ?>
									
								<?php 
                    } else {
                        /* Post format is quote */
                        ?>
								
									<blockquote class="blockquote-bg">
										<?php 
                        $quote_content = get_the_excerpt();
                        if (!$quote_content) {
                            $quote_content = get_the_content();
                        }
                        echo do_shortcode($quote_content);
                        ?>
									</blockquote>
									<div class="blockquote-meta">
										<?php 
                        if ($show_date && $show_thumbnail) {
                            ?>
										<span class="date-time">
											<i class="fa fa-calendar"></i>
											<?php 
                            the_time(get_option('date_format'));
                            ?>
										</span>
										<?php 
                        }
                        ?>
										
										<?php 
                        if ($show_author) {
                            ?>
										<span class="author">
											<i class="fa fa-user"></i>
											<?php 
                            the_author_posts_link();
                            ?>
										</span>
										<?php 
                        }
                        ?>
									</div>
									
								<?php 
                    }
                    /* End quote */
                    ?>
								
							</li>
						<?php 
                    if ($count % $row == $row - 1 || $count == $num_posts - 1) {
                        ?>
	
							</ul>
						</div>
						<?php 
                    }
                    ?>
					<?php 
                    $count++;
                }
                ?>
				</div>
				
				<?php 
            }
            echo $after_widget;
            wp_reset_postdata();
        }
Пример #3
0
							<?php 
        if ($post_format != 'gallery' && $post_format !== false && $post_format != 'standard') {
            ?>
							<div class="date-time date-time-meta">
								<i class="fa fa-calendar"></i> <?php 
            echo get_the_time(get_option('date_format'));
            ?>
							</div>
							<?php 
        }
        ?>
						</header>	
						
						<!-- Blog Excerpt -->
						<div class="excerpt"><?php 
        ts_the_excerpt_max_words(18, '', true, '', true);
        ?>
</div>
						
						<!-- Blog Author -->
						<!--<span class="author"><?php 
        //esc_html_e('Post by ','gon')
        //the_author_posts_link();
        ?>
</span>-->
						
						<!-- Blog Read More -->
						<a href="<?php 
        the_permalink();
        ?>
" class="button-readmore"><?php 
Пример #4
0
        ?>
				</div>
				<?php 
    }
    ?>
				
				<div class="entry-summary">
					<!-- Blog Excerpt -->
					<?php 
    if ($smof_data['ts_blog_excerpt']) {
        ?>
					<div class="short-content">
						<?php 
        $max_words = (int) $smof_data['ts_blog_excerpt_max_words'] ? (int) $smof_data['ts_blog_excerpt_max_words'] : 125;
        $strip_tags = $smof_data['ts_blog_excerpt_strip_tags'] ? true : false;
        ts_the_excerpt_max_words($max_words, $post, $strip_tags, '', true);
        ?>
					</div>
					<?php 
    }
    ?>
					
					<!-- Blog Read More Button -->
					<?php 
    if ($smof_data['ts_blog_read_more']) {
        ?>
					<a class="button-readmore" href="<?php 
        the_permalink();
        ?>
"><?php 
        esc_html_e('Read More', 'gon');
Пример #5
0
function ts_template_loop_short_description_listview()
{
    global $product, $post, $smof_data;
    $list_limit_words = absint($smof_data['ts_prod_cat_list_desc_words']);
    $show_list_desc = $smof_data['ts_prod_cat_list_desc'];
    $is_archive = is_tax('product_cat') || is_tax('product_tag') || is_post_type_archive('product');
    if ($show_list_desc && $is_archive) {
        ?>
		<div class="short-description list" style="display: none" >
			<?php 
        ts_the_excerpt_max_words($list_limit_words, '', true, '', true);
        ?>
		</div>
	<?php 
    }
}