本文整理汇总了PHP中get_random_header_image函数的典型用法代码示例。如果您正苦于以下问题:PHP get_random_header_image函数的具体用法?PHP get_random_header_image怎么用?PHP get_random_header_image使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_random_header_image函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: boom_header_image
/**
* Retrieve header image for custom header.
*
* @since 0.1
* @uses HEADER_IMAGE
* @uses HEADER_IMAGE_WIDTH
* @uses HEADER_IMAGE_HEIGHT
*
* @return string
*/
function boom_header_image($width = null, $height = null)
{
$default = defined('HEADER_IMAGE') ? HEADER_IMAGE : '';
$url = get_theme_mod('header_image', $default);
$width = defined('HEADER_IMAGE_WIDTH') ? HEADER_IMAGE_WIDTH : $width;
$height = defined('HEADER_IMAGE_HEIGHT') ? HEADER_IMAGE_HEIGHT : $height;
if ('remove-header' == $url) {
return false;
} elseif ('boom-slider-uploaded' == $url || 'boom-slider-default' == $url) {
// slider
echo boom_build_nivo_slider(boom_get_header_images(), $width, $height);
return;
} elseif (is_random_header_image()) {
// random header mode
$url = get_random_header_image();
}
if (is_ssl()) {
$url = str_replace('http://', 'https://', $url);
} else {
$url = str_replace('https://', 'http://', $url);
}
$output = "<img src='" . esc_url_raw($url) . "' alt='' />";
echo $output;
}
开发者ID:rafaqtro,项目名称:mozillavenezuela.org,代码行数:34,代码来源:general-template.php
示例2: is_random_header_image
/**
* Check if random header image is in use.
*
* Always true if user expressly chooses the option in Appearance > Header.
* Also true if theme has multiple header images registered, no specific header image
* is chosen, and theme turns on random headers with add_theme_support().
*
* @since 3.2.0
*
* @param string $type The random pool to use. any|default|uploaded
* @return boolean
*/
function is_random_header_image($type = 'any')
{
$header_image_mod = get_theme_mod('header_image', get_theme_support('custom-header', 'default-image'));
if ('any' == $type) {
if ('random-default-image' == $header_image_mod || 'random-uploaded-image' == $header_image_mod || '' != get_random_header_image() && empty($header_image_mod)) {
return true;
}
} else {
if ("random-{$type}-image" == $header_image_mod) {
return true;
} elseif ('default' == $type && empty($header_image_mod) && '' != get_random_header_image()) {
return true;
}
}
return false;
}
开发者ID:radman,项目名称:noobyo-blog,代码行数:28,代码来源:theme.php
示例3: is_random_header_image
/**
* Check if random header image is in use.
*
* Always true if user expressly chooses the option in Appearance > Header.
* Also true if theme has multiple header images registered, no specific header image
* is chosen, and theme turns on random headers with add_theme_support().
*
* @since 3.2.0
* @uses HEADER_IMAGE
*
* @param string $type The random pool to use. any|default|uploaded
* @return boolean
*/
function is_random_header_image($type = 'any')
{
$default = defined('HEADER_IMAGE') ? HEADER_IMAGE : '';
$header_image_mod = get_theme_mod('header_image', $default);
if ('any' == $type) {
if ('random-default-image' == $header_image_mod || 'random-uploaded-image' == $header_image_mod || '' != get_random_header_image() && empty($header_image_mod)) {
return true;
}
} else {
if ("random-{$type}-image" == $header_image_mod) {
return true;
} elseif ('default' == $type && empty($header_image_mod) && '' != get_random_header_image()) {
return true;
}
}
return false;
}
开发者ID:Esleelkartea,项目名称:asociacion-tecnicos-artes-escenicas-ATAE-,代码行数:30,代码来源:theme.php
示例4: jacket_core_custom_header_style
function jacket_core_custom_header_style()
{
global $jacket_core;
if (!isset($jacket_core->custom_header['css_name']) || empty($jacket_core->custom_header['css_name'])) {
return;
}
$css_txt = '';
$css_image = get_header_image();
// ISSUE:: Random images don't work!
if (empty($css_image)) {
$css_image = get_random_header_image();
}
if (empty($css_image)) {
$css_image = $jacket_core->custom_header['header_image'];
}
$h_height = apply_filters('jacket_core_custom_header_css_background_height', get_custom_header()->height);
$h_width = apply_filters('jacket_core_custom_header_css_background_width', get_custom_header()->width);
if (!empty($h_height)) {
$css_txt .= "\n height: " . $h_height . 'px;';
}
/*
ISSUE::
Below Commented because we want the header to be more responsive.
This will keep custom header image from pushing outside of
the containing element
if ( !empty( $h_width ) ) $css_txt .= "\n width: " . $h_width . 'px;';
*/
if (!empty($jacket_core->custom_header['css_bg_color'])) {
$css_txt .= "\n background-color: " . $jacket_core->custom_header['css_bg_color'] . ';';
}
if (!empty($css_image)) {
$css_image = apply_filters('jacket_core_custom_header_css_background_url', $css_image);
$css_txt .= "\n background-image: " . ' url("' . $css_image . '");';
if (!isset($jacket_core->custom_header['css_repeat_from_theme']) && $jacket_core->custom_header['css_repeat_from_theme'] != true) {
if (!empty($jacket_core->custom_header['css_repeat'])) {
$css_txt .= "\n background-repeat: " . $jacket_core->custom_header['css_repeat'] . ';';
}
}
if (!isset($jacket_core->custom_header['css_position_from_theme']) && $jacket_core->custom_header['css_position_from_theme'] != true) {
if (!empty($jacket_core->custom_header['css_position_x'])) {
$css_position_txt .= ' ' . $jacket_core->custom_header['css_position_x'];
}
if (!empty($jacket_core->custom_header['css_position_y'])) {
$css_position_txt .= ' ' . $jacket_core->custom_header['css_position_y'];
}
if (!empty(${$css_position_txt})) {
$css_txt .= "\n background-position: " . $css_position_txt . ';';
}
}
}
$css_txt = apply_filters('jacket_core_custom_header_css_background', $css_txt);
if (empty($css_txt)) {
return;
}
?>
<style type="text/css">
<?php
echo $jacket_core->custom_header['css_name'];
?>
{
<?php
echo $css_txt . "\n";
?>
}
</style><?php
}
开发者ID:nicholls-state-university,项目名称:nicholls-2015-core,代码行数:67,代码来源:functions.php
注:本文中的get_random_header_image函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论