예제 #1
0
    public function tc_get_popular_posts($qty, $comment_num, $days, $date, $show_thumbnail_5, $show_excerpt, $excerpt_length)
    {
        global $post;
        $popular_days = array();
        if ($days) {
            $popular_days = array('after' => "{$days} day ago", 'before' => 'today', 'inclusive' => true);
        }
        $posts = get_posts(array('suppress_filters' => false, 'ignore_sticky_posts' => 1, 'orderby' => 'comment_count', 'numberposts' => $qty, 'date_query' => $popular_days));
        echo '<ul class="tc-popular-posts tc-sidebar-widget">';
        foreach ($posts as $post) {
            setup_postdata($post);
            ?>
			<li <?php 
            if ($show_thumbnail_5 != 1) {
                ?>
class="no-thumbnail" <?php 
            }
            ?>
>
				<div class="post-img">
					<a href="<?php 
            the_permalink();
            ?>
">
						<?php 
            if ($show_thumbnail_5 == 1) {
                ?>
						    <?php 
                the_post_thumbnail('widget-thumbnail', array('title' => ''));
                ?>
						<?php 
            }
            ?>
					</a>
				</div>
				<div class="post-data">
					<a href="<?php 
            the_permalink();
            ?>
" alt="<?php 
            the_title();
            ?>
"><?php 
            the_title();
            ?>
</a>
					<div class="popular-post-meta">
						<?php 
            if ($date == 1) {
                ?>
							<?php 
                the_time('F j, Y');
                ?>
,
						<?php 
            }
            ?>
						<?php 
            if ($date == 1 && $comment_num == 1) {
                ?>
							
						<?php 
            }
            ?>
						<?php 
            if ($comment_num == 1) {
                ?>
							<?php 
                echo comments_number(__('No Comment', 'themecountry'), __('One Comment', 'themecountry'), '<span class="comm">%</span> ' . __('Comments', 'themecountry'));
                ?>
						<?php 
            }
            ?>
					</div> <!--end .entry-meta-->
					<?php 
            if ($show_excerpt == 1) {
                ?>
						<p>
							<?php 
                echo tc_excerpt($excerpt_length);
                ?>
						</p>
					<?php 
            }
            ?>
				</div>
				<span class="clear"></span>
			</li>	
		<?php 
        }
        echo '</ul>' . "\r\n";
    }
예제 #2
0
    public function tc_get_author_posts($qty, $comment_num, $date, $show_thumbnail_3, $show_excerpt, $excerpt_length)
    {
        global $post;
        $thePostID = $post->ID;
        $posts = new WP_Query(array('author' => $post->author, 'post__not_in' => array($thePostID), 'posts_per_page' => $qty, 'orderby' => 'rand'));
        echo '<ul class="tc-related-posts tc-sidebar-widget">';
        while ($posts->have_posts()) {
            $posts->the_post();
            ?>
			<li <?php 
            if ($show_thumbnail_3 != 1) {
                ?>
class="no-thumbnail" <?php 
            }
            ?>
>
				<div class="post-img">
					<a href="<?php 
            the_permalink();
            ?>
">
						<?php 
            if ($show_thumbnail_3 == 1) {
                ?>
						    <?php 
                the_post_thumbnail('widget-thumbnail', array('title' => ''));
                ?>
						<?php 
            }
            ?>
	
					</a>
				</div>
				<div class="post-data">
					<a href="<?php 
            the_permalink();
            ?>
" alt="<?php 
            the_title();
            ?>
"><?php 
            the_title();
            ?>
</a>
					<div class="recent-post-meta">
						<?php 
            if ($date == 1) {
                ?>
							<?php 
                the_time('F j, Y');
                ?>
						<?php 
            }
            ?>
						<?php 
            if ($date == 1 && $comment_num == 1) {
                ?>
							
						<?php 
            }
            ?>
						<?php 
            if ($comment_num == 1) {
                ?>
							<?php 
                echo comments_number(__('No Comment', 'themecountry'), __('One Comment', 'themecountry'), '<span class="comm">%</span> ' . __('Comments', 'themecountry'));
                ?>
						<?php 
            }
            ?>
					</div> <!--end .entry-meta-->
					<?php 
            if ($show_excerpt == 1) {
                ?>
						<p>
							<?php 
                echo tc_excerpt($excerpt_length);
                ?>
						</p>
					<?php 
            }
            ?>
				</div>
				<span class="clear"></span>
			</li>	
		<?php 
        }
        echo '</ul>' . "\r\n";
    }
예제 #3
0
    public function tc_get_recent_posts($qty, $comment_num, $date, $show_thumbnail_1, $show_excerpt, $excerpt_length)
    {
        $posts = new WP_Query("orderby=date&order=DESC&posts_per_page=" . $qty);
        echo '<ul class="tc-recent-posts tc-sidebar-widget">';
        while ($posts->have_posts()) {
            $posts->the_post();
            ?>
			<li <?php 
            if ($show_thumbnail_1 != 1) {
                ?>
class="no-thumbnail" <?php 
            }
            ?>
>
				<div class="post-img">
					<a href="<?php 
            the_permalink();
            ?>
">
						<?php 
            if ($show_thumbnail_1 == 1) {
                ?>
						    <?php 
                the_post_thumbnail('widget-thumbnail', array('title' => ''));
                ?>
						<?php 
            }
            ?>
	
					</a>
				</div>
				<div class="post-data">
					<a href="<?php 
            the_permalink();
            ?>
" alt="<?php 
            the_title();
            ?>
"><?php 
            the_title();
            ?>
</a>
					<div class="recent-post-meta">
						<?php 
            if ($date == 1) {
                ?>
							<?php 
                the_time('F j, Y');
                ?>
,
						<?php 
            }
            ?>
						<?php 
            if ($date == 1 && $comment_num == 1) {
                ?>
							
						<?php 
            }
            ?>
						<?php 
            if ($comment_num == 1) {
                ?>
							<?php 
                echo comments_number(__('No Comment', 'themecountry'), __('One Comment', 'themecountry'), '<span class="comm">%</span> ' . __('Comments', 'themecountry'));
                ?>
						<?php 
            }
            ?>
					</div> <!--end .entry-meta-->
					<?php 
            if ($show_excerpt == 1) {
                ?>
						<p>
							<?php 
                echo tc_excerpt($excerpt_length);
                ?>
						</p>
					<?php 
            }
            ?>
				</div>
				<span class="clear"></span>
			</li>	
		<?php 
        }
        echo '</ul>' . "\r\n";
    }