当前位置: 首页>>代码示例>>PHP>>正文


PHP catch_first_image函数代码示例

本文整理汇总了PHP中catch_first_image函数的典型用法代码示例。如果您正苦于以下问题:PHP catch_first_image函数的具体用法?PHP catch_first_image怎么用?PHP catch_first_image使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了catch_first_image函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: the_permalink

<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>
开发者ID:surmon-china,项目名称:Wordpress_Theme_Metro,代码行数:31,代码来源:articlepic.php

示例2: the_permalink

            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 
开发者ID:xiapistudio,项目名称:tinection-fixed,代码行数:31,代码来源:related.php

示例3: widget

    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 
//.........这里部分代码省略.........
开发者ID:xiapistudio,项目名称:tinection-fixed,代码行数:101,代码来源:tin-posts.php

示例4: foreach

            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');
开发者ID:w392807287,项目名称:FirstRepository,代码行数:31,代码来源:page.php

示例5: tin_thumbnail

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;
}
开发者ID:jackycgq,项目名称:tinection-pro,代码行数:10,代码来源:functions.php

示例6: widget


//.........这里部分代码省略.........
                    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 
开发者ID:xiapistudio,项目名称:tinection-xps,代码行数:67,代码来源:widget-tabs.php

示例7: while

  <?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();
开发者ID:w392807287,项目名称:FirstRepository,代码行数:31,代码来源:blog.php

示例8: while

		<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 
开发者ID:xiapistudio,项目名称:tinection-fixed,代码行数:31,代码来源:slider.php

示例9: widget

    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;
    }
开发者ID:xiapistudio,项目名称:tinection-fixed,代码行数:99,代码来源:tin-slider.php

示例10: enews_posts_list

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();
}
开发者ID:w392807287,项目名称:FirstRepository,代码行数:37,代码来源:E-list.php

示例11: the_permalink

      <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 
开发者ID:w392807287,项目名称:FirstRepository,代码行数:31,代码来源:cms.php

示例12: foreach

       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 
开发者ID:Neilpang,项目名称:enews,代码行数:31,代码来源:single.php


注:本文中的catch_first_image函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。