本文整理汇总了PHP中ts_attr_is_false函数的典型用法代码示例。如果您正苦于以下问题:PHP ts_attr_is_false函数的具体用法?PHP ts_attr_is_false怎么用?PHP ts_attr_is_false使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ts_attr_is_false函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: ts_option_vs_default
clearfix">
<?php
$exc_lnth = ts_option_vs_default('excerpt_length_2col_medium', 320);
$excerpt_length = isset($atts['excerpt_length']) && $atts['excerpt_length'] != '' ? $atts['excerpt_length'] : $exc_lnth;
$ts_show = ts_maybe_show_blog_elements($atts);
$show_excerpt = $excerpt_length == '0' || !$ts_show->excerpt ? false : true;
$title_size = ts_get_blog_loop_title_size($atts, 2);
$text_align = ts_get_blog_loop_text_align($atts);
$allow_vids = isset($atts['allow_videos']) ? $atts['allow_videos'] : 'yes';
$allow_gals = isset($atts['allow_galleries']) ? $atts['allow_galleries'] : 'yes';
if ($ts_query->have_posts()) {
$i = 1;
while ($ts_query->have_posts()) {
$ts_query->the_post();
$atts['exclude_these_later'] = isset($atts['exclude_these_later']) ? $atts['exclude_these_later'] : '';
if (!ts_attr_is_false($atts['exclude_these_later'])) {
$ts_previous_posts[] = $ts_query->post->ID;
}
$post_type = get_post_type();
$category = ts_get_the_category('category', 'big_array:1', '', $ts_query->post->ID);
$media = ts_get_featured_media(array('allow_videos' => $allow_vids, 'allow_galleries' => $allow_gals));
?>
<div id="post-<?php
echo esc_attr($ts_query->post->ID);
?>
" class="hentry entry">
<div class="post-content">
<div class="post-category post-category-heading mimic-small uppercase">
<a href="<?php
echo get_category_link($category[0]['term_id']);
开发者ID:estvmachine,项目名称:nicowp,代码行数:31,代码来源:loop.php
示例2: ts_get_featured_media
function ts_get_featured_media($arg = array())
{
global $post, $smof_data, $ts_show_sidebar, $ts_page_id, $ts_within_blog_loop;
$defaults = array('allow_audio' => false, 'allow_videos' => true, 'allow_galleries' => true);
$arg = wp_parse_args($arg, $defaults);
$html = '';
$ready = false;
$within_slider = isset($arg['within_slider']) && ts_attr_is_true($arg['within_slider']) ? true : false;
$is_single_featured_media = isset($arg['is_single']) && $arg['is_single'] === true && $post->ID == $ts_page_id ? true : false;
$posttype = get_post_type($post->ID);
$post_meta_prefix = $posttype == 'portfolio' ? '_portfolio_' : '_p_';
if ($posttype == 'portfolio') {
$crop_images = ts_option_vs_default('crop_images_on_portfolio', 1) ? true : false;
} else {
$crop_images = ts_option_vs_default('crop_images_on_blog', 1) ? true : false;
}
$get_alt_text_in_loop = ts_option_vs_default('featured_image_alt_text_within_loop', 0) ? true : false;
$get_alt_text = $is_single_featured_media || $get_alt_text_in_loop ? true : false;
$video_id = $return_link = '';
if ($ts_show_sidebar == 'yes') {
if ($crop_images) {
$crop_width = 740;
$crop_height = 480;
} else {
$crop_width = 740;
$crop_height = 0;
}
} else {
if ($crop_images) {
$crop_width = 1100;
$crop_height = 540;
} else {
$crop_width = 1100;
$crop_height = 0;
}
}
if (isset($arg['media_height']) && $arg['media_height'] !== false && isset($arg['media_width']) && $arg['media_width'] !== false) {
$crop_width = $arg['media_width'];
$crop_height = $arg['media_height'];
}
$seek_thumb_size_name = $crop_width > 1024 ? 'full' : 'large';
//ts_figure_thumb_name($crop_width, $crop_height);
$allow_audio = isset($arg['allow_audio']) && ts_attr_is_true($arg['allow_audio']) ? true : false;
$allow_videos = isset($arg['allow_videos']) && ts_attr_is_false($arg['allow_videos']) ? false : true;
$allow_self_hosted_video = isset($arg['allow_self_hosted_video']) && ts_attr_is_true($arg['allow_self_hosted_video']) ? true : false;
$allow_video_embed_code = isset($arg['allow_video_embed_code']) && ts_attr_is_false($arg['allow_video_embed_code']) ? false : true;
$allow_galleries = isset($arg['allow_galleries']) && ts_attr_is_false($arg['allow_galleries']) ? false : true;
if (isset($arg['video_height']) && isset($arg['video_width'])) {
$video_width = 'width="' . esc_attr($arg['video_width']) . '"';
$video_height = 'height="' . esc_attr($arg['video_height']) . '"';
} else {
$video_width = '';
$video_height = '';
}
$audio_class = isset($arg['audio_class']) ? $arg['audio_class'] : '';
$media_class = isset($arg['media_class']) ? $arg['media_class'] : '';
$show_caption = isset($arg['show_caption']) && $arg['show_caption'] === true ? true : false;
$post_format = $posttype == 'portfolio' ? get_post_meta($post->ID, $post_meta_prefix . 'project_type', true) : get_post_format();
if ($allow_videos && in_array($post_format, array('video', 'youtube', 'vimeo', 'self_hosted_video'))) {
$vine = '';
// not used for now
$vimeo = get_post_meta($post->ID, $post_meta_prefix . 'vimeo_id', true);
$youtube = get_post_meta($post->ID, $post_meta_prefix . 'youtube_id', true);
$self_hosted = get_post_meta($post->ID, $post_meta_prefix . 'self_hosted_video', true);
$embed_code = get_post_meta($post->ID, $post_meta_prefix . 'video_embed_code', true);
$post_format = $vimeo || $youtube || $self_hosted || $embed_code ? 'video' : 'standard';
if ($self_hosted && !$allow_self_hosted_video) {
$post_format = 'standard';
}
if ($embed_code && !$allow_video_embed_code) {
$post_format = 'standard';
}
} elseif ($allow_galleries && in_array($post_format, array('gallery', 'slider'))) {
$post_format = 'gallery';
} elseif ($allow_audio && in_array($post_format, array('audio', 'soundcloud', 'spotify', 'self_hosted_audio'))) {
$soundcloud = get_post_meta($post->ID, $post_meta_prefix . 'soundcloud_id', true);
$spotify = get_post_meta($post->ID, $post_meta_prefix . 'spotify_id', true);
$self_hosted_audio = get_post_meta($post->ID, $post_meta_prefix . 'self_hosted_audio', true);
$post_format = $soundcloud || $spotify || $self_hosted_audio ? 'audio' : 'standard';
} else {
$post_format = 'standard';
}
$preview = get_post_meta($post->ID, $post_meta_prefix . 'preview_image', true);
$preview_id = get_post_meta($post->ID, $post_meta_prefix . 'preview_image_id', true);
$post_format = $preview && trim($preview) && $ts_page_id != $post->ID ? 'standard' : $post_format;
$class = isset($arg['class']) ? $arg['class'] : '';
$color = str_replace('#', '', ts_option_vs_default('primary_color', ''));
if ($post_format == 'video') {
$html .= $class ? '<div class="' . esc_attr($class) . '">' : '';
if ($vimeo) {
$qs_addons = ts_get_video_qs_addons($vimeo, '&');
$video_id = ts_get_video_id($vimeo);
$return_link = 'https://vimeo.com/' . $video_id;
$iframe_id = 'vimeo-' . $video_id . '-' . mt_rand();
$src_append = $within_slider ? '&api=1&player_id=' . $iframe_id : '';
$html .= '<div class="fluid-width-video-wrapper ' . esc_attr($media_class) . '"><div>
<iframe id="' . esc_attr($iframe_id) . '" src="' . esc_url('https://player.vimeo.com/video/' . $video_id . '?title=0&byline=0&portrait=0&color=' . $color . $src_append . $qs_addons) . '" class="ts-vimeo-player" frameborder="0" webkitAllowFullScreen allowFullScreen ' . $video_width . ' ' . $video_height . '></iframe>
</div></div>';
} elseif ($self_hosted) {
$html .= '<div class="fluid-width-video-wrapperx ' . esc_attr($media_class) . '">
//.........这里部分代码省略.........
开发者ID:estvmachine,项目名称:nicowp,代码行数:101,代码来源:theme-functions.php
注:本文中的ts_attr_is_false函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论