本文整理汇总了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;
}
}