本文整理汇总了PHP中td_util::get_featured_image_src方法的典型用法代码示例。如果您正苦于以下问题:PHP td_util::get_featured_image_src方法的具体用法?PHP td_util::get_featured_image_src怎么用?PHP td_util::get_featured_image_src使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类td_util
的用法示例。
在下文中一共展示了td_util::get_featured_image_src方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wp_head_hook_background_logic
function wp_head_hook_background_logic()
{
global $post, $paged;
$background_params = array('is_boxed_layout' => false, 'is_stretched_bg' => false, 'theme_bg_image' => td_util::get_option('tds_site_background_image'), 'theme_bg_repeat' => td_util::get_option('tds_site_background_repeat'), 'theme_bg_position' => td_util::get_option('tds_site_background_position_x'), 'theme_bg_attachment' => td_util::get_option('tds_site_background_attachment'), 'theme_bg_color' => td_util::get_option('tds_site_background_color'), 'td_ad_background_click_link' => stripslashes(td_util::get_option('tds_background_click_url')), 'td_ad_background_click_target' => td_util::get_option('tds_background_click_target'));
/* --------------------------------------------------------------------------
Read the background settings
*/
// is stretch background?
if (td_util::get_option('tds_stretch_background') == 'yes') {
$background_params['is_stretched_bg'] = true;
}
// activate the boxed layout - if we have an image or color
if ($background_params['theme_bg_image'] != '' or $background_params['theme_bg_color'] != '') {
$background_params['is_boxed_layout'] = true;
}
/* --------------------------------------------------------------------------
we are on a category
*/
if (is_category()) {
// try to read the category settings
$post_primary_category_id = intval(get_query_var('cat'));
//we are on a category, get the id @todo verify this, get_query_var('cat') may not work with permalinks
$background_params = $this->get_category_bg_settings($post_primary_category_id, $background_params);
} elseif (is_page()) {
$td_page = get_query_var('page') ? get_query_var('page') : 1;
//rewrite the global var
$td_paged = get_query_var('paged') ? get_query_var('paged') : 1;
//rewrite the global var
if ($td_paged > $td_page) {
$paged = $td_paged;
} else {
$paged = $td_page;
}
if (!empty($post->post_content) and strpos($post->post_content, 'td_block_homepage_full_1') !== false and (empty($paged) or $paged < 2)) {
// deactivate the background only on td_block_homepage_full_1 + page 1.
// on the second page, load it with the normal site wide background
//$background_params['theme_bg_image'] = '';
return;
// THIS SHORTCODE disables the background AND background color!
}
} elseif (is_singular('post')) {
//is_single runs on all the posts types, that's why we need is_singular
// try to read the background settings for the parent category of this post
$post_primary_category_id = intval(td_global::get_primary_category_id());
// we are on single post - get the primary category id
$background_params = $this->get_category_bg_settings($post_primary_category_id, $background_params);
// read the per post single_template
$post_meta_values = get_post_meta($post->ID, 'td_post_theme_settings', true);
// if we don't have any single_template set on this post, try to laod the default global setting
if (empty($post_meta_values['td_post_template'])) {
$td_site_post_template = td_util::get_option('td_default_site_post_template');
} else {
$td_site_post_template = $post_meta_values['td_post_template'];
}
if (!empty($td_site_post_template)) {
// we have a single_template set on a per post basis or on the global setting in the pane > post settings -> default post template (site wide)
// overwrite the theme_bg_image with the featured image if needed
if (td_api_single_template::get_key($td_site_post_template, 'bg_use_featured_image_as_background') === true) {
$background_params['theme_bg_image'] = td_util::get_featured_image_src($post->ID, 'full');
$background_params['is_stretched_bg'] = true;
}
// disable the background image if needed - used by singe_post_templates that implement their own backgrounds
if (td_api_single_template::get_key($td_site_post_template, 'bg_disable_background') === true) {
$background_params['theme_bg_image'] = '';
$background_params['theme_bg_color'] = '';
}
// overwrite the box layout settings with the ones provided here
switch (td_api_single_template::get_key($td_site_post_template, 'bg_box_layout_config')) {
case 'auto':
// do nothing - the site will load the site wide boxed layout settings
break;
case 'td-boxed-layout':
//force a boxed layout regardless if the site has a bg image or bg color
$background_params['is_boxed_layout'] = true;
break;
case 'td-full-layout':
//force a full layout regardless if the site has a bg image or bg color
$background_params['is_boxed_layout'] = false;
break;
}
}
}
// WE HAVE TO HAVE A IMAGE OR COLOR - @todo wtf needs to be refactorized
new td_background_render($background_params);
}
示例2: inner
function inner($posts, $td_column_number = '')
{
ob_start();
if (!empty($posts[0])) {
$post = $posts[0];
//we get only one post
// $td_post_featured_image = td_util::get_featured_image_src($post->ID, 'full');
$td_mod_single = new td_module_single($post);
//make the js template
?>
<!-- add class to body, no jQuery and inline -->
<?php
ob_start();
?>
<script>
document.body.className+=' td-boxed-layout single_template_8 homepage-post ';
</script>
<?php
echo ob_get_clean();
?>
<script type="text/template" id="<?php
echo $this->block_uid . '_tmpl';
?>
">
<article id="post-<?php
echo $td_mod_single->post->ID;
?>
" class="<?php
echo join(' ', get_post_class('post td-post-template-8'));
?>
" <?php
echo $td_mod_single->get_item_scope();
?>
>
<div class="td-post-header td-image-gradient-style8">
<div class="td-crumb-container"><?php
echo td_page_generator::get_single_breadcrumbs($td_mod_single->title);
?>
</div>
<div class="td-post-header-holder">
<header class="td-post-title">
<?php
echo $td_mod_single->get_category();
?>
<?php
echo $td_mod_single->get_title();
?>
<?php
if (!empty($td_mod_single->td_post_theme_settings['td_subtitle'])) {
?>
<p class="td-post-sub-title"><?php
echo $td_mod_single->td_post_theme_settings['td_subtitle'];
?>
</p>
<?php
}
?>
<div class="td-module-meta-info">
<?php
echo $td_mod_single->get_author();
?>
<?php
echo $td_mod_single->get_date(false);
?>
<?php
echo $td_mod_single->get_views();
?>
<?php
echo $td_mod_single->get_comments();
?>
</div>
</header>
</div>
</div>
</article>
</script>
<?php
$td_post_featured_image = td_util::get_featured_image_src($post->ID, 'full');
ob_start();
?>
<script>
//.........这里部分代码省略.........
示例3: join
<?php
// Template 7 -post-final-7.psd - full image background
$td_post_featured_image = td_util::get_featured_image_src($post->ID, 'full');
if (!empty($td_post_featured_image)) {
td_js_buffer::add_to_footer('jQuery(window).ready(function() {' . "\r\n" . '(function(){' . "\r\n" . 'var td_backstr_item = new td_backstr.item();' . "\r\n" . 'td_backstr_item.wrapper_image_jquery_obj = jQuery("#td-full-screen-header-image");' . "\r\n" . 'td_backstr_item.image_jquery_obj = td_backstr_item.wrapper_image_jquery_obj.find(\'img:first\');' . "\r\n" . 'td_backstr.add_item(td_backstr_item);' . "\r\n" . "jQuery('.td-read-down a').click(function(event){" . "\r\n" . "event.preventDefault();" . "\r\n" . "var header_wrap = jQuery('.td-full-screen-header-image-wrap:first')" . "\r\n" . "if (header_wrap.length == 1) {" . "\r\n" . "td_util.scroll_to_position(header_wrap.height() + header_wrap.offset().top, 1200);" . "\r\n" . "}" . "\r\n" . "});" . "\r\n" . '})();' . "\r\n" . '});');
}
//get the global sidebar position from single.php
global $loop_sidebar_position;
// sidebar position used to align the breadcrumb on sidebar left + sidebar first on mobile issue
$td_sidebar_position = '';
if ($loop_sidebar_position == 'sidebar_left') {
$td_sidebar_position = 'td-sidebar-left';
}
$td_mod_single = new td_module_single($post);
?>
<article id="post-<?php
echo $td_mod_single->post->ID;
?>
" class="<?php
echo join(' ', get_post_class('td-post-template-7'));
?>
" <?php
echo $td_mod_single->get_item_scope();
?>
>
<div class="td-full-screen-header-image-wrap">
<div class="td-container td-post-header">
示例4: inner
function inner($posts, $td_column_number = '')
{
ob_start();
if (!empty($posts[0])) {
$post = $posts[0];
//we get only one post
$td_post_featured_image = td_util::get_featured_image_src($post->ID, 'full');
$td_mod_single = new td_module_single($post);
//make the js template
?>
<script type="text/template" id="<?php
echo $this->block_uid . '_tmpl';
?>
">
<article id="post-<?php
echo $td_mod_single->post->ID;
?>
"
class="<?php
echo join(' ', get_post_class('td-post-template-6'));
?>
" <?php
echo $td_mod_single->get_item_scope();
?>
>
<div class="template6-header">
<div class="td-post-header td-container" id="td_parallax_header_6">
<header class="td-pb-padding-side">
<?php
echo $td_mod_single->get_category();
?>
<?php
echo $td_mod_single->get_title();
?>
<?php
if (!empty($td_mod_single->td_post_theme_settings['td_subtitle'])) {
?>
<p class="td-post-sub-title"><?php
echo $td_mod_single->td_post_theme_settings['td_subtitle'];
?>
</p>
<?php
}
?>
<div class="meta-info">
<?php
echo $td_mod_single->get_author();
?>
<?php
echo $td_mod_single->get_date(false);
?>
<?php
echo $td_mod_single->get_views();
?>
<?php
echo $td_mod_single->get_comments();
?>
</div>
<div class="td-read-down"><a href="#"><i class="td-icon-read-down"></i></a></div>
</header>
</div>
</div>
</article>
</script>
<?php
td_js_buffer::add_to_footer("jQuery('body').addClass('single_template_6');" . "\r\n" . "jQuery('body').prepend(jQuery('#" . $this->block_uid . "_tmpl').html());" . "\r\n" . 'jQuery(\'body\').prepend(\'<div class="td-full-screen-header-image-wrap"><div id="td-full-screen-header-image" class="td-image-gradient"></div></div>\');' . "\r\n" . 'jQuery().ready(function() {' . "\r\n" . "jQuery('#td-full-screen-header-image').backstretch('" . $td_post_featured_image . "', {fade:1200, centeredY:false});" . "\r\n" . 'td_post_template_6_title();' . "\r\n" . "jQuery('.td-read-down a').click(function(event){" . "\r\n" . "event.preventDefault();" . "\r\n" . "td_util.scroll_to_position(jQuery('.td-full-screen-header-image-wrap').height(), 1200);" . "\r\n" . "});" . "\r\n" . '});');
}
return ob_get_clean();
}