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


PHP td_util::attachment_get_src方法代码示例

本文整理汇总了PHP中td_util::attachment_get_src方法的典型用法代码示例。如果您正苦于以下问题:PHP td_util::attachment_get_src方法的具体用法?PHP td_util::attachment_get_src怎么用?PHP td_util::attachment_get_src使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在td_util的用法示例。


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

示例1: get_image

 /**
  * v3 23 ian 2015
  * @param $thumbType
  * @return string
  */
 function get_image($thumbType)
 {
     global $page;
     //        if ( //check to see if the current single template is configured to show the featured image on the second page
     //            !isset( td_global::$single_templates_list[td_global::$cur_single_template]['show_featured_image_on_all_pages'] )
     //            or td_global::$single_templates_list[td_global::$cur_single_template]['show_featured_image_on_all_pages'] === false
     //        ){
     if (td_api_single_template::_check_show_featured_image_on_all_pages(td_global::$cur_single_template) === false) {
         //the post is configured to show the featured image only on the first page
         if (!empty($page) and $page > 1) {
             return '';
         }
     }
     //do not show the featured image if the global setting is set to hide - show the video preview regardless of the setting
     if (td_util::get_option('tds_show_featured_image') == 'hide' and get_post_format($this->post->ID) != 'video') {
         return '';
     }
     //handle video post format
     if (get_post_format($this->post->ID) == 'video') {
         //if it's a video post...
         $td_post_video = get_post_meta($this->post->ID, 'td_post_video', true);
         $td_video_support = new td_video_support();
         //render the video if the post has a video in the featured video section of the post
         if (!empty($td_post_video['td_video'])) {
             return $td_video_support->renderVideo($td_post_video['td_video']);
         }
     } else {
         //if it's a normal post, show the default thumb
         if ($this->post_has_thumb) {
             //get the featured image id + full info about the 640px wide one
             $featured_image_id = get_post_thumbnail_id($this->post->ID);
             $featured_image_info = td_util::attachment_get_full_info($featured_image_id, $thumbType);
             //get the full size for the popup
             $featured_image_full_size_src = td_util::attachment_get_src($featured_image_id, 'full');
             $buffy = '';
             $show_td_modal_image = td_util::get_option('tds_featured_image_view_setting');
             if (is_single()) {
                 if ($show_td_modal_image != 'no_modal') {
                     //wrap the image_html with a link + add td-modal-image class
                     $image_html = '<a href="' . $featured_image_full_size_src['src'] . '" data-caption="' . esc_attr($featured_image_info['caption'], ENT_QUOTES) . '">';
                     $image_html .= '<img width="' . $featured_image_info['width'] . '" height="' . $featured_image_info['height'] . '" itemprop="image" class="entry-thumb td-modal-image" src="' . $featured_image_info['src'] . '" alt="' . $featured_image_info['alt'] . '" title="' . $featured_image_info['title'] . '"/>';
                     $image_html .= '</a>';
                 } else {
                     //no_modal
                     $image_html = '<img width="' . $featured_image_info['width'] . '" height="' . $featured_image_info['height'] . '" itemprop="image" class="entry-thumb" src="' . $featured_image_info['src'] . '" alt="' . $featured_image_info['alt'] . '" title="' . $featured_image_info['title'] . '"/>';
                 }
             } else {
                 //on blog index page
                 $image_html = '<a href="' . $this->href . '"><img width="' . $featured_image_info['width'] . '" height="' . $featured_image_info['height'] . '" itemprop="image" class="entry-thumb" src="' . $featured_image_info['src'] . '" alt="' . $featured_image_info['alt'] . '" title="' . $featured_image_info['title'] . '"/></a>';
             }
             $buffy .= '<div class="td-post-featured-image">';
             // caption - put html5 wrapper on when we have a caption
             if (!empty($featured_image_info['caption'])) {
                 $buffy .= '<figure>';
                 $buffy .= $image_html;
                 $buffy .= '<figcaption class="wp-caption-text">' . $featured_image_info['caption'] . '</figcaption>';
                 $buffy .= '</figure>';
             } else {
                 $buffy .= $image_html;
             }
             $buffy .= '</div>';
             return $buffy;
         } else {
             return '';
             //the post has no thumb
         }
     }
 }
开发者ID:Che234,项目名称:andreatelo,代码行数:73,代码来源:td_module_single_base.php


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