<div class="thumbnail">
<a href="<?php 
    the_permalink();
    ?>
" rel="bookmark" title="<?php 
    the_title();
    ?>
">
<!--<?php 
    if (has_post_thumbnail()) {
        the_post_thumbnail('thumbnail');
    } else {
        ?>
-->
<img class="home-thumb" src="<?php 
        echo catch_first_image();
        ?>
" width="140px" height="100px" alt="<?php 
        the_title();
        ?>
"/>
<!--<?php 
    }
    ?>
-->
</a>
<!--<?php 
}
?>
-->
</div></div>
            if (!has_post_thumbnail()) {
                ?>
	
						<a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title();
                ?>
" class="">
							<div class="thumb-img">
								<img <?php 
                echo $lazy;
                ?>
="<?php 
                $imgsrc = catch_first_image();
                echo tin_thumb_source($imgsrc, 175, 126, false);
                ?>
">
								<span><?php 
                the_article_icon();
                ?>
</span>
							</div>
						</a>
						<?php 
            }
            ?>
					</div>
					<div class="relpost-inner-text">
						<a href="<?php 
    public function widget($args, $instance)
    {
        extract($args);
        $instance['title'] ? NULL : ($instance['title'] = '');
        $title = apply_filters('widget_title', $instance['title']);
        $output = $before_widget . "\n";
        if ($title) {
            $output .= $before_title . $title . $after_title;
        }
        ob_start();
        ?>

	<?php 
        $posts = new WP_Query(array('post_type' => array('post'), 'showposts' => $instance['posts_num'], 'cat' => $instance['posts_cat_id'], 'ignore_sticky_posts' => true, 'orderby' => $instance['posts_orderby'], 'order' => 'dsc', 'date_query' => array(array('after' => $instance['posts_time']))));
        ?>
	<?php 
        if (ot_get_option('lazy_load_img') == 'on') {
            $lazy = 'class="box-hide" src="' . THEME_URI . '/images/image-pending.gif" data-original';
        } else {
            $lazy = 'src';
        }
        ?>
	<ul class="tin-posts group <?php 
        if ($instance['posts_thumb']) {
            echo 'thumbs-enabled';
        }
        ?>
">
		<?php 
        $i = 0;
        ?>
		<?php 
        while ($posts->have_posts()) {
            $posts->the_post();
            ?>
		<?php 
            $large_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');
            ?>
		<?php 
            $r = fmod($i, 2);
            $i++;
            ?>
			
		<?php 
            if ($instance['posts_thumb']) {
                // Thumbnails enabled?
                ?>
		<li class="<?php 
                if ($r == 0) {
                    echo 'list-left';
                } else {
                    echo 'list-right';
                }
                ?>
">	
			<div class="post-item-thumbnail">
				<a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title();
                ?>
">
					<?php 
                if (has_post_thumbnail()) {
                    ?>
						<img <?php 
                    echo $lazy;
                    ?>
="<?php 
                    $imgsrc = $large_image_url[0];
                    echo tin_thumb_source($imgsrc, 353, 220, false);
                    ?>
" alt="<?php 
                    the_title();
                    ?>
" />
					<?php 
                } else {
                    ?>
						<img <?php 
                    echo $lazy;
                    ?>
="<?php 
                    $imgsrc = catch_first_image();
                    echo tin_thumb_source($imgsrc, 353, 220, false);
                    ?>
" alt="<?php 
                    the_title();
                    ?>
" />
					<?php 
                }
                ?>
				</a>
				<div class="tin-posts-float-title">
					<a href="<?php 
                the_permalink();
                ?>
" rel="bookmark" title="<?php 
                the_title();
                ?>
"><?php 
                the_title();
                ?>
</a>
				</div>
			</div>
			<div class="post-item-inner group">
				<?php 
                if ($instance['posts_date']) {
                    ?>
<span class="post-item-date" style="float:left;"><?php 
                    the_time('Y-m-j');
                    ?>
</span><?php 
                }
                ?>
				<?php 
                if ($instance['posts_category']) {
                    ?>
<span class="post-item-category" style="float:right;"><?php 
                    the_category(' / ');
                    ?>
</span><?php 
                }
                ?>
			</div>
		<?php 
            } else {
                ?>
		<li class="list-single-col">	
			<div class="tin-posts-title">
				<a href="<?php 
                the_permalink();
                ?>
" rel="bookmark" title="<?php 
                the_title();
                ?>
"><?php 
                the_title();
                ?>
</a>
				<?php 
                if ($instance['posts_date']) {
                    ?>
<span class="post-item-date" style="float:right;"><?php 
                    the_time('Y-m-j');
                    ?>
</span><?php 
                }
                ?>
			</div>
		<?php 
            }
            ?>
			
		</li>
		<?php 
        }
        ?>
	</ul>
<?php 
        $output .= ob_get_clean();
        $output .= $after_widget . "\n";
        echo $output;
    }
Beispiel #4
0
            foreach ($tag as $tags) {
                $arr[] = $tags->term_id;
            }
            $args = array('posts_per_page' => 4, 'post__not_in' => array($post->ID), 'orderby' => 'rand', 'tax_query' => array(array('taxonomy' => 'post_tag', 'terms' => $arr)));
            $query = new WP_Query($args);
            if ($query->have_posts()) {
                ?>
    <div class="related-posts">
	<h3>你可能也喜欢</h3>
	<div class="related">
	 	<?php 
                $i = 1;
                while ($query->have_posts()) {
                    $query->the_post();
                    $i == 6 ? $pdn = "class='pdn'" : ($pdn = "");
                    echo "<div class='item span3'><a href=" . get_permalink() . "> <figure class='figure-hover'>\r\n         <img alt='" . get_the_title() . "' src='" . catch_first_image('m') . "'/>\r\n         <div class='figure-hover-masked'>\r\n          <p class='icon-plus'></p>\r\n         </div>\r\n        </figure>\r\n       </a>\r\n       <p>" . get_the_title() . "</p>\r\n      </div>";
                    $i++;
                }
                wp_reset_query();
                ?>
	</div>
    </div>
    <div class="sep-border"></div>
	<?php 
            }
        }
        ?>
      

      <?php 
        $ad5_close = get_option('ad5_close');
Beispiel #5
0
function tin_thumbnail()
{
    if (has_post_thumbnail()) {
        $large_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');
        $imgsrc = $large_image_url[0];
    } else {
        $imgsrc = catch_first_image();
    }
    return $imgsrc;
}
    public function widget($args, $instance)
    {
        extract($args);
        $instance['title'] ? NULL : ($instance['title'] = '');
        $title = apply_filters('widget_title', $instance['title']);
        $output = $before_widget . "\n";
        if ($title) {
            $output .= $before_title . $title . $after_title;
        }
        ob_start();
        /*  Set tabs-nav order & output it
        /* ------------------------------------ */
        $titles = array('recent' => $instance['title_latestpost'], 'popular' => $instance['title_hotpost'], 'comments' => $instance['title_comment']);
        $tabs = array();
        $count = 0;
        $order = array('recent' => $instance['order_recent'], 'popular' => $instance['order_popular'], 'comments' => $instance['order_comments']);
        asort($order);
        foreach ($order as $key => $value) {
            if ($instance[$key . '_enable']) {
                $tabs[] = $key;
                $count++;
            }
        }
        if ($tabs && $count > 1) {
            $output .= $this->_create_tabs($titles, $tabs, $count);
        }
        ?>
	<?php 
        if (ot_get_option('lazy_load_img') == 'on') {
            $lazy = 'class="box-hide" src="' . THEME_URI . '/images/image-pending.gif" data-original';
        } else {
            $lazy = 'src';
        }
        ?>
	<div class="tin-tabs-container">
		<?php 
        if ($instance['recent_enable']) {
            // Recent posts enabled?
            ?>
			<?php 
            $recent = new WP_Query();
            ?>
			<?php 
            $recent->query('showposts=' . $instance["recent_num"] . '&cat=' . $instance["recent_cat_id"] . '&ignore_sticky_posts=1');
            ?>
			<ul id="tab-recent" class="tin-tab group <?php 
            if ($instance['recent_thumbs']) {
                echo 'thumbs-enabled';
            } else {
                echo 'no-pic';
            }
            ?>
">
				<?php 
            while ($recent->have_posts()) {
                $recent->the_post();
                ?>
				<?php 
                $large_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');
                ?>
				<li>
					<?php 
                if ($instance['recent_thumbs']) {
                    // Thumbnails enabled?
                    ?>
					<div class="tab-item-thumbnail">
						<a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
">
							<?php 
                    if (has_post_thumbnail()) {
                        ?>
							<div class="thumb-img">
								<img <?php 
                        echo $lazy;
                        ?>
="<?php 
                        echo tin_thumb_source($large_image_url[0], 125, 78, false);
                        ?>
" alt="<?php 
                        the_title();
                        ?>
" />
								<span><?php 
                        the_article_icon();
                        ?>
</span>
							</div>								
							<?php 
                    } else {
                        ?>
							<div class="thumb-img">
								<img <?php 
                        echo $lazy;
                        ?>
="<?php 
                        $img = catch_first_image();
                        echo tin_thumb_source($img, 125, 78, false);
                        ?>
" alt="<?php 
                        the_title();
                        ?>
" />
								<span><?php 
                        the_article_icon();
                        ?>
</span>
							</div>
							<?php 
                    }
                    ?>
						</a>
					</div>
					<?php 
                }
                ?>
					
					<div class="tab-item-inner group">
						<p class="tab-item-title"><a href="<?php 
                the_permalink();
                ?>
" rel="bookmark" title="<?php 
                the_title();
                ?>
"><?php 
                the_title();
                ?>
</a></p>
						<?php 
                if ($instance['tabs_date']) {
                    ?>
<span class="tab-item-date"><?php 
                    the_time('Y-m-j');
                    ?>
</span><?php 
                }
                ?>
&nbsp;
						<?php 
                if ($instance['tabs_category']) {
                    ?>
<span class="tab-item-category"><?php 
                    the_category(' / ');
                    ?>
</span><?php 
                }
                ?>
					</div>
					
				</li>
				<?php 
            }
            ?>
			</ul><!--/.tin-tab-->

		<?php 
        }
        ?>

		<?php 
        if ($instance['popular_enable']) {
            // Popular posts enabled?
            ?>
				
			<?php 
            $popular = new WP_Query(array('post_type' => array('post'), 'showposts' => $instance['popular_num'], 'cat' => $instance['popular_cat_id'], 'ignore_sticky_posts' => true, 'orderby' => 'comment_count', 'order' => 'dsc', 'date_query' => array(array('after' => $instance['popular_time']))));
            ?>
			<ul id="tab-popular" class="tin-tab group <?php 
            if ($instance['popular_thumbs']) {
                echo 'thumbs-enabled';
            } else {
                echo 'no-pic';
            }
            ?>
">
				
				<?php 
            while ($popular->have_posts()) {
                $popular->the_post();
                ?>
				<?php 
                $large_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');
                ?>
				<li>
				
					<?php 
                if ($instance['popular_thumbs']) {
                    // Thumbnails enabled?
                    ?>
					<div class="tab-item-thumbnail">
						<a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
">
							<?php 
                    if (has_post_thumbnail()) {
                        ?>
							<div class="thumb-img">
								<img <?php 
                        echo $lazy;
                        ?>
="<?php 
                        echo tin_thumb_source($large_image_url[0], 125, 78, false);
                        ?>
" alt="<?php 
                        the_title();
                        ?>
" />
								<span><?php 
                        the_article_icon();
                        ?>
</span>
							</div>
							<?php 
                    } else {
                        ?>
							<div class="thumb-img">
								<img <?php 
                        echo $lazy;
                        ?>
="<?php 
                        $img = catch_first_image();
                        echo tin_thumb_source($img, 125, 78, false);
                        ?>
" alt="<?php 
                        the_title();
                        ?>
" />
								<span><?php 
                        the_article_icon();
                        ?>
</span>
							</div>
							<?php 
                    }
                    ?>
						</a>
					</div>
					<?php 
                }
                ?>
					
					<div class="tab-item-inner group">
						<p class="tab-item-title"><a href="<?php 
                the_permalink();
                ?>
" rel="bookmark" title="<?php 
                the_title();
                ?>
"><?php 
                the_title();
                ?>
</a></p>
						<?php 
                if ($instance['tabs_date']) {
                    ?>
<span class="tab-item-date"><?php 
                    the_time('Y-m-j');
                    ?>
</span><?php 
                }
                ?>
&nbsp;
						<?php 
                if ($instance['tabs_category']) {
                    ?>
<span class="tab-item-category"><?php 
                    the_category(' / ');
                    ?>
</span><?php 
                }
                ?>
					</div>
					
				</li>
				<?php 
            }
            ?>
			</ul><!--/.tin-tab-->
			
		<?php 
        }
        ?>
		<?php 
        if ($instance['comments_enable']) {
            // Recent comments enabled?
            ?>

			<?php 
            $args = array('number' => $instance["comments_num"], 'status' => 'approve', 'post_status' => 'publish');
            if (isset($instance['comment_order']) && $instance['comment_order'] == 'vote') {
                $args['orderby'] = 'meta_value_num';
                $args['meta_key'] = 'tin_comment_voteyes';
            }
            $comments = get_comments($args);
            ?>
			
			<ul id="tab-comments" class="tin-tab group <?php 
            if ($instance['comments_avatars']) {
                echo 'avatars-enabled';
            } else {
                echo 'no-avatar';
            }
            ?>
">
				<?php 
            foreach ($comments as $comment) {
                ?>
				<li>
					
						<?php 
                if ($instance['comments_avatars']) {
                    // Avatars enabled?
                    ?>
						<div class="tab-item-avatar">
							<?php 
                    echo tin_get_avatar($comment->user_id, '96', tin_get_avatar_type($comment->user_id));
                    ?>
						</div>
						<?php 
                }
                ?>
						
						<div class="tab-item-inner group">
							<?php 
                $comment_excerpt = preg_replace("'\\[private](.*?)\\[\\/private]'", '***该评论仅父级评论者及管理员可见***', get_comment_excerpt($comment->comment_ID));
                $str = explode(' ', $comment_excerpt);
                $comment_excerpt = implode(' ', array_slice($str, 0, 11));
                if (count($str) > 11 && substr($comment_excerpt, -1) != '.') {
                    $comment_excerpt .= '...';
                }
                ?>
					
							<div class="tab-item-comment"><span class="arrow-poptop"></span><a href="<?php 
                echo esc_url(get_permalink($comment->comment_post_ID));
                ?>
"><i><?php 
                echo $comment->comment_author;
                ?>
</i><?php 
                _e('说: ', 'xiapistudio');
                echo $comment_excerpt;
                ?>
</a><div class="tab-cmt-votes"><span class="cmt-vote">
					<?php 
                $c_name = 'tin_comment_vote_' . $comment->comment_ID;
                $cookie = isset($_COOKIE[$c_name]) ? $_COOKIE[$c_name] : '';
                ?>
					<i class="fa fa-thumbs-o-up <?php 
                if ($cookie == 1) {
                    echo 'voted';
                }
                ?>
" title="<?php 
                _e('顶', 'xiapistudio');
                ?>
" data="<?php 
                echo $comment->comment_ID;
                ?>
" data-type="1" data-num="<?php 
                echo (int) get_comment_meta($comment->comment_ID, 'tin_comment_voteyes', true);
                ?>
"><?php 
                echo ' [' . (int) get_comment_meta($comment->comment_ID, 'tin_comment_voteyes', true) . ']';
                ?>
</i>
					<i class="fa fa-thumbs-o-down <?php 
                if ($cookie == 2) {
                    echo 'voted';
                }
                ?>
" title="<?php 
                _e('踩', 'xiapistudio');
                ?>
" data="<?php 
                echo $comment->comment_ID;
                ?>
" data-type="2" data-num="<?php 
                echo (int) get_comment_meta($comment->comment_ID, 'tin_comment_voteno', true);
                ?>
"><?php 
                echo ' [' . (int) get_comment_meta($comment->comment_ID, 'tin_comment_voteno', true) . ']';
                ?>
</i>
				</span></div></div>
							
						</div>

				</li>
				<?php 
            }
            ?>
			</ul><!--/.tin-tab-->

		<?php 
        }
        ?>
	</div>

<?php 
        $output .= ob_get_clean();
        $output .= $after_widget . "\n";
        echo $output;
    }
Beispiel #7
0
  <?php 
}
?>
  <?php 
if (have_posts()) {
    ?>
  <?php 
    while (have_posts()) {
        the_post();
        ?>
  <div class="post clearfix">
    <figure> <a href="<?php 
        the_permalink();
        ?>
"><img src="<?php 
        echo catch_first_image('medium');
        ?>
" alt="<?php 
        the_title_attribute();
        ?>
" class="enews" /></a> </figure>
    <div class="content">
      <h2><a href="<?php 
        the_permalink();
        ?>
" title="详细阅读 <?php 
        the_title_attribute();
        ?>
">
        <?php 
        the_title();
Beispiel #8
0
		<ul class="slides">
		<?php 
    while ($featured_query->have_posts()) {
        $featured_query->the_post();
        $i++;
        ?>
			<?php 
        if (function_exists("has_post_thumbnail") && has_post_thumbnail()) {
            ?>
			<?php 
            $large_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');
            ?>
			<?php 
            $img = $large_image_url[0];
        } else {
            $img = catch_first_image();
        }
        ?>
			<li>
				<?php 
        $format = get_post_format();
        $video = get_post_meta(get_the_ID(), 'tin_video_url', true);
        if ($format == 'video' && !empty($video)) {
            ?>
				<div class="slider-img" style="position: relative;"><img src="<?php 
            echo tin_thumb_source($img, 600, 336, false);
            ?>
" alt="<?php 
            the_title();
            ?>
"/><div class="slider-video"><a rel="iframes" class="" href="javascript:" data="<?php 
    public function widget($args, $instance)
    {
        extract($args);
        $instance['title'] ? NULL : ($instance['title'] = '');
        $title = apply_filters('widget_title', $instance['title']);
        $output = $before_widget . "\n";
        if ($title) {
            $output .= $before_title . $title . $after_title;
        }
        ob_start();
        ?>

	<?php 
        $posts = new WP_Query(array('post_type' => array('post'), 'showposts' => $instance['posts_num'], 'cat' => $instance['posts_cat_id'], 'ignore_sticky_posts' => true, 'orderby' => $instance['posts_orderby'], 'order' => 'dsc', 'date_query' => array(array('after' => $instance['posts_time']))));
        ?>
	<script type="text/javascript">
		$(document).ready(function(){
			$('.tin-slider').flexslider({
				animation: "fade",
				direction:"horizontal",
				easing:"swing",
				pauseOnHover:true,
				slideshowSpeed: 5000,
				animationDuration:600,
				prevText: "",
				nextText: "",
				directionNav:false,
				randomize:true
			});
		});
	</script>
	<div class="tin-slider">
	<ul class="slides">
		<?php 
        while ($posts->have_posts()) {
            $posts->the_post();
            ?>
		<?php 
            $large_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');
            ?>
		
		<li>	
			<a href="<?php 
            the_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
">
			<?php 
            if (has_post_thumbnail()) {
                ?>
			<img src="<?php 
                $imgsrc = $large_image_url[0];
                echo tin_thumb_source($imgsrc, 350, 250, false);
                ?>
" alt="<?php 
                the_title();
                ?>
" style="width:350px;height:250px;" />
			<?php 
            } else {
                ?>
			<img src="<?php 
                $imgsrc = catch_first_image();
                echo tin_thumb_source($imgsrc, 350, 250, false);
                ?>
" alt="<?php 
                the_title();
                ?>
" style="width:350px;height:250px;" />
			<?php 
            }
            ?>
			</a>
			<div class="widget-slider-title trans">
				<a href="<?php 
            the_permalink();
            ?>
" rel="bookmark" title="<?php 
            the_title();
            ?>
"><?php 
            the_title();
            ?>
</a>
			</div>
		</li>
		<?php 
        }
        wp_reset_query();
        ?>
	</ul>
	</div>
<?php 
        $output .= ob_get_clean();
        $output .= $after_widget . "\n";
        echo $output;
    }
Beispiel #10
0
function enews_posts_list($orderby, $limit, $cat, $img)
{
    $args = array('order' => DESC, 'cat' => $cat, 'orderby' => $orderby, 'showposts' => $limit, 'caller_get_posts' => 1);
    query_posts($args);
    while (have_posts()) {
        the_post();
        ?>
<li><a href="<?php 
        the_permalink();
        ?>
">
  <?php 
        if ($img) {
            echo '<span class="thumbnail"><img src="';
            echo catch_first_image();
            echo '" /></span>';
        } else {
            $img = '';
        }
        ?>
  <span class="text">
  <?php 
        the_title();
        ?>
  </span><span class="muted">
  <?php 
        the_time('Y-m-d');
        ?>
  </span><span class="muted">
  <?php 
        comments_number('', '1评论', '%评论');
        ?>
  </span></a></li>
<?php 
    }
    wp_reset_query();
}
Beispiel #11
0
      <div class="base">
        <h4><?php 
            echo "{$cat_name}";
            ?>
</h4>
        <a href="<?php 
            echo $cat_link;
            ?>
">More....</a> </div>
    </div>
    <div class="item"> <a href="<?php 
            the_permalink();
            ?>
">
      <figure class="figure-hover"> <img src="<?php 
            echo catch_first_image('m');
            ?>
" alt="<?php 
            the_title();
            ?>
"> </figure>
      </a>
      <div class="content">
        <h3><a title="<?php 
            the_title_attribute();
            ?>
" href="<?php 
            the_permalink();
            ?>
">
          <?php 
Beispiel #12
0
       foreach ($tag as $tags) {
           $arr[] = $tags->term_id;
       }
       $args = array('posts_per_page' => 4, 'post__not_in' => array($post->ID), 'orderby' => 'rand', 'tax_query' => array(array('taxonomy' => 'post_tag', 'terms' => $arr)));
       $query = new WP_Query($args);
       if ($query->have_posts()) {
           ?>
 <div class="related-posts">
   <h3>你可能也喜欢</h3>
   <div class="related">
     <?php 
           $i = 1;
           while ($query->have_posts()) {
               $query->the_post();
               $i == 6 ? $pdn = "class='pdn'" : ($pdn = "");
               echo "<div class='item span3'><a href=" . get_permalink() . "> <figure class='figure-hover'>\n         <img src='" . get_template_directory_uri() . "/timthumb.php?src=" . catch_first_image() . "&h=190&w=185&zc=1' class='thumbnail' />\n         <div class='figure-hover-masked'>\n          <p class='icon-plus'></p>\n         </div>\n        </figure>\n       </a>\n       <p>" . get_the_title() . "</p>\n      </div>";
               $i++;
           }
           ?>
   </div>
 </div>
 <div class="sep-border"></div>
 <?php 
       }
   }
   ?>
 <?php 
   $ad5_close = get_option('ad5_close');
   if ($ad5_close == 'open') {
       ?>
 <div  class="k_ad"> <?php