當前位置: 首頁>>代碼示例>>PHP>>正文


PHP td_util::if_show方法代碼示例

本文整理匯總了PHP中td_util::if_show方法的典型用法代碼示例。如果您正苦於以下問題:PHP td_util::if_show方法的具體用法?PHP td_util::if_show怎麽用?PHP td_util::if_show使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在td_util的用法示例。


在下文中一共展示了td_util::if_show方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: get_image


//.........這裏部分代碼省略.........
      *  - if we don't have a post thumb, check the image placeholder option and if we're also not a single page show the image placeholder.
      */
     if ($this->post_has_thumb or $featured_image_placeholder == '') {
         //and !is_single()//comment this so we can have image placeholder on single post pages
         if ($image_link == '') {
             $image_link = $this->href;
         } else {
             //we are in post, only posts use $image_link
             if (td_util::get_option('tds_featured_image_view_setting') == '') {
                 if (is_single()) {
                     $show_colorbox_class = true;
                 } else {
                     $image_link = $this->href;
                     $show_colorbox_class = false;
                 }
             }
             if (td_util::get_option('tds_featured_image_view_setting') == 'lightbox') {
                 $show_colorbox_class = true;
             }
             if (td_util::get_option('tds_featured_image_view_setting') == 'no_link') {
                 $image_link = '';
                 //remove the link if we have that option
             }
         }
         if ($this->post_has_thumb) {
             // check to see if the thumb size is enabled in the panel
             if (td_util::get_option('tds_thumb_' . $thumbType) != 'yes' and TD_THEME_NAME == 'Newsmag') {
                 // remove Newsmag check on newspaper 5
                 global $_wp_additional_image_sizes;
                 if (empty($_wp_additional_image_sizes[$thumbType]['width'])) {
                     $td_temp_image_url[1] = '';
                 } else {
                     $td_temp_image_url[1] = $_wp_additional_image_sizes[$thumbType]['width'];
                 }
                 if (empty($_wp_additional_image_sizes[$thumbType]['height'])) {
                     $td_temp_image_url[2] = '';
                 } else {
                     $td_temp_image_url[2] = $_wp_additional_image_sizes[$thumbType]['height'];
                 }
                 $td_temp_image_url[0] = get_template_directory_uri() . '/images/thumb-disabled/' . $thumbType . '.png';
                 $attachment_alt = '';
                 $attachment_title = '';
             } else {
                 //if we have a thumb
                 $attachment_id = get_post_thumbnail_id($this->post->ID);
                 $td_temp_image_url = wp_get_attachment_image_src($attachment_id, $thumbType);
                 $attachment_alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true);
                 $attachment_alt = 'alt="' . esc_attr(strip_tags($attachment_alt)) . '"';
                 $attachment_title = ' title="' . $this->title . '"';
                 if (empty($td_temp_image_url[0])) {
                     $td_temp_image_url[0] = '';
                 }
                 if (empty($td_temp_image_url[1])) {
                     $td_temp_image_url[1] = '';
                 }
                 if (empty($td_temp_image_url[2])) {
                     $td_temp_image_url[2] = '';
                 }
             }
             // end panel thumb enabled check
         } else {
             //we have no thumb but the placeholder one is activated
             global $_wp_additional_image_sizes;
             if (empty($_wp_additional_image_sizes[$thumbType]['width'])) {
                 $td_temp_image_url[1] = '';
             } else {
                 $td_temp_image_url[1] = $_wp_additional_image_sizes[$thumbType]['width'];
             }
             if (empty($_wp_additional_image_sizes[$thumbType]['height'])) {
                 $td_temp_image_url[2] = '';
             } else {
                 $td_temp_image_url[2] = $_wp_additional_image_sizes[$thumbType]['height'];
             }
             $td_temp_image_url[0] = get_template_directory_uri() . '/images/no-thumb/' . $thumbType . '.png';
             $attachment_alt = '';
             $attachment_title = '';
         }
         $buffy .= '<div class="td-module-thumb">';
         if (current_user_can('edit_posts')) {
             $buffy .= '<a class="td-admin-edit" href="' . get_edit_post_link($this->post->ID) . '">edit</a>';
         }
         if ($image_link != '') {
             $buffy .= '<a href="' . $image_link . '" rel="bookmark" title="' . $this->title_attribute . '">';
         }
         $buffy .= '<img width="' . $td_temp_image_url[1] . '" height="' . $td_temp_image_url[2] . '" itemprop="image" class="entry-thumb' . td_util::if_show($show_colorbox_class, 'td-modal-image') . '" src="' . $td_temp_image_url[0] . '" ' . $attachment_alt . $attachment_title . '/>';
         if (get_post_format($this->post->ID) == 'video') {
             if ($thumbType == 'td_100x75' or $thumbType == 'td_80x60' or $thumbType == 'thumbnail') {
                 $buffy .= '<span class="td-video-play-ico td-video-small"><img width="20" class="td-retina" src="' . get_template_directory_uri() . '/images/icons/video-small.png' . '" alt="video"/></span>';
             } else {
                 $buffy .= '<span class="td-video-play-ico"><img width="40" class="td-retina" src="' . get_template_directory_uri() . '/images/icons/ico-video-large.png' . '" alt="video"/></span>';
             }
         }
         if ($image_link != '') {
             $buffy .= '</a>';
         }
         $buffy .= $image_excerpt;
         $buffy .= '</div>';
         return $buffy;
     }
 }
開發者ID:vikasjain1595,項目名稱:wordpresstheme,代碼行數:101,代碼來源:td_module.php


注:本文中的td_util::if_show方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。