本文整理汇总了PHP中get_custom_header函数的典型用法代码示例。如果您正苦于以下问题:PHP get_custom_header函数的具体用法?PHP get_custom_header怎么用?PHP get_custom_header使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_custom_header函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: chaostheory_setup
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which runs
* before the init hook. The init hook is too late for some features, such as indicating
* support post thumbnails.
*/
function chaostheory_setup()
{
/**
* Make theme available for translation
* Translations can be filed in the /languages/ directory
* If you're building a theme based on chaostheory, use a find and replace
* to change 'chaostheory' to the name of your theme in all the template files
*/
load_theme_textdomain('chaostheory', get_template_directory() . '/languages');
/**
* Add default posts and comments RSS feed links to head
*/
add_theme_support('automatic-feed-links');
/**
* Enable support for Post Thumbnails on posts and pages
*
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support('post-thumbnails');
set_post_thumbnail_size(get_custom_header()->width, get_custom_header()->height, true);
/**
* This theme uses wp_nav_menu() in one location.
*/
register_nav_menus(array('primary' => __('Primary Navigation', 'chaostheory')));
}
示例2: cc_add_header_image
function cc_add_header_image()
{
global $post;
$header_image = get_header_image();
$custom_header_image = get_custom_header();
/*echo '<!-- debug: header_image ' . print_r( array('header_image' => $header_image, 'custom_header_image' => $custom_header_image ), true ). ' -->';*/
if (!empty($header_image)) {
?>
<div class="cc-header-image">
<a class="cc-header-image-link" href="<?php
echo esc_url(home_url('/'));
?>
" title="<?php
echo esc_attr(get_bloginfo('name', 'display'));
?>
" rel="home">
<img src="<?php
echo $header_image;
?>
" width="<?php
echo $custom_header_image->width;
?>
" height="<?php
echo $custom_header_image->height;
?>
" alt="">
</a>
</div>
<?php
}
}
示例3: mh_logo
function mh_logo()
{
$header_img = get_header_image();
$header_title = get_bloginfo('name');
$header_desc = get_bloginfo('description');
echo '<a href="' . esc_url(home_url('/')) . '" title="' . esc_attr($header_title) . '" rel="home">' . "\n";
echo '<div class="logo-wrap" role="banner">' . "\n";
if ($header_img) {
echo '<img src="' . esc_url($header_img) . '" height="' . get_custom_header()->height . '" width="' . get_custom_header()->width . '" alt="' . esc_attr($header_title) . '" />' . "\n";
}
if (display_header_text()) {
$header_img ? $logo_pos = 'logo-overlay' : ($logo_pos = 'logo-text');
$text_color = get_header_textcolor();
if ($text_color != get_theme_support('custom-header', 'default-text-color')) {
echo '<style type="text/css" id="mh-header-css">';
echo '.logo-name, .logo-desc { color: #' . esc_attr($text_color) . '; }';
echo '.logo-name { border-bottom: 3px solid #' . esc_attr($text_color) . '; }';
echo '</style>' . "\n";
}
echo '<div class="logo ' . $logo_pos . '">' . "\n";
if ($header_title) {
echo '<h1 class="logo-name">' . esc_attr($header_title) . '</h1>' . "\n";
}
if ($header_desc) {
echo '<h2 class="logo-desc">' . esc_attr($header_desc) . '</h2>' . "\n";
}
echo '</div>' . "\n";
}
echo '</div>' . "\n";
echo '</a>' . "\n";
}
示例4: chuchadon_header_style
/**
* Styles the header image and text displayed on the blog
*
* @see chuchadon_custom_header_setup().
*/
function chuchadon_header_style()
{
/* Header text color. */
$header_color = get_header_textcolor();
/* Header image. */
$header_image = esc_url(get_header_image());
/* Start header styles. */
$style = '';
/* Header image height. */
$header_height = get_custom_header()->height;
/* Header image width. */
$header_width = get_custom_header()->width;
/* When to show header image. */
$min_width = absint(apply_filters('chuchadon_header_bg_show', 800));
$background_arguments = esc_attr(apply_filters('chuchadon_header_bg_arguments', 'no-repeat'));
if (!empty($header_image)) {
$style .= "@media screen and (min-width: {$min_width}px) { body.custom-header-image .site-header { background: url({$header_image}) {$background_arguments}; -webkit-background-size: 50%; -moz-background-size: 50%; -o-background-size: 50%; background-size: 50%; } }";
}
/* Site title styles. */
if (display_header_text()) {
$style .= ".home-title a { color: #{$header_color} }";
}
if (!display_header_text()) {
$style .= ".home-title, .home-description { clip: rect(1px, 1px, 1px, 1px); position: absolute; height: 1px; width: 1px; overflow: hidden; }";
}
/* Echo styles if it's not empty. */
if (!empty($style)) {
echo "\n" . '<style type="text/css" id="custom-header-css">' . trim($style) . '</style>' . "\n";
}
}
示例5: colormag_render_header_image
/**
* Shows the small info text on top header part
*/
function colormag_render_header_image()
{
$header_image = get_header_image();
if (!empty($header_image)) {
if (get_theme_mod('colormag_header_image_link', 0) == 1) {
?>
<a href="<?php
echo esc_url(home_url('/'));
?>
" title="<?php
echo esc_attr(get_bloginfo('name', 'display'));
?>
" rel="home">
<?php
}
?>
<div class="header-image-wrap"><img src="http://thevrforums.com/images/banner.png" class="header-image" width="<?php
echo get_custom_header()->width;
?>
" height="<?php
echo get_custom_header()->height;
?>
" alt="<?php
echo esc_attr(get_bloginfo('name', 'display'));
?>
"></div>
<?php
if (get_theme_mod('colormag_header_image_link', 0) == 1) {
?>
</a>
<?php
}
}
}
示例6: magik_custom_header_wp_head
/**
* Callback function for outputting the custom header CSS to `wp_head`.
*
* @since 1.0.0
* @access public
* @return void
*/
function magik_custom_header_wp_head()
{
$header_image = get_header_image();
$style = "body.custom-header #branding { }";
$style = sprintf('body.custom-header #branding { background: url(%1$s) center center no-repeat !important; text-indent: -9999px;background-size: %2$dpx %3$dpx !important; min-height: %3$dpx}', esc_url($header_image), absint(get_custom_header()->width / 2), absint(get_custom_header()->height / 2));
echo "\n" . '<style type="text/css" id="custom-header-css">' . trim($style) . '</style>' . "\n";
}
示例7: franz_header_image
/**
* Creates the tag for header image
*/
function franz_header_image()
{
$header = get_custom_header();
if ($header->url) {
/* Scale hidpi header image */
$custom_header = get_theme_support('custom-header');
$header_args = array_pop($custom_header);
if ($header->width >= 2 * $header_args['width']) {
$header->width = floor($header->width / 2);
$header->height = floor($header->height / 2);
}
?>
<img class="img-responsive" src="<?php
echo esc_url($header->url);
?>
" height="<?php
echo esc_attr($header->height);
?>
" width="<?php
echo esc_attr($header->width);
?>
" alt="" />
<?php
} else {
bloginfo('name');
}
}
示例8: mh_newsdesk_lite_logo
function mh_newsdesk_lite_logo()
{
$header_img = get_header_image();
$header_title = get_bloginfo('name');
$header_desc = get_bloginfo('description');
echo '<a href="' . esc_url(home_url('/')) . '" title="' . esc_attr($header_title) . '" rel="home">' . "\n";
echo '<div class="logo-wrap" role="banner">' . "\n";
if ($header_img) {
echo '<img src="' . esc_url($header_img) . '" height="' . get_custom_header()->height . '" width="' . get_custom_header()->width . '" alt="' . esc_attr($header_title) . '" />' . "\n";
}
if (0 && display_header_text()) {
$text_color = get_header_textcolor();
if ($text_color != get_theme_support('custom-header', 'default-text-color')) {
echo '<style type="text/css" id="mh-header-css">';
echo '.logo-title, .logo-tagline { color: #' . esc_attr($text_color) . '; }';
echo '</style>' . "\n";
}
echo '<div class="logo">' . "\n";
if ($header_title) {
echo '<h1 class="logo-title">' . esc_attr($header_title) . '</h1>' . "\n";
}
if ($header_desc) {
echo '<h2 class="logo-tagline">' . esc_attr($header_desc) . '</h2>' . "\n";
}
echo '</div>' . "\n";
}
echo '</div>' . "\n";
echo '</a>' . "\n";
}
示例9: encounters_lite_admin_header_image
/**
* Outputs markup to be displayed on the Appearance > Header admin panel.
* This callback overrides the default markup displayed there.
*
*/
function encounters_lite_admin_header_image()
{
?>
<div id="headimg">
<?php
$header_image = get_header_image();
if (!empty($header_image)) {
?>
<img src="<?php
echo esc_url($header_image);
?>
" class="header-image" width="<?php
echo get_custom_header()->width;
?>
" height="<?php
echo get_custom_header()->height;
?>
" alt="" />
<?php
}
?>
</div>
<?php
}
示例10: contango_admin_header_image
/** Styles the header image and text displayed on the blog preview. */
function contango_admin_header_image()
{
?>
<div id="headimg">
<?php
if (get_header_image()) {
?>
<div id="logo-image">
<a href="<?php
echo esc_url(home_url('/'));
?>
" onclick="return false;"><img src="<?php
header_image();
?>
" width="<?php
echo esc_attr(get_custom_header()->width);
?>
" height="<?php
echo esc_attr(get_custom_header()->height);
?>
" alt="<?php
bloginfo('name');
?>
" /></a>
</div><!-- end of #logo -->
<?php
} else {
// header image was removed
?>
<div id="logo-text">
<span class="site-name"><a href="<?php
echo esc_url(home_url('/'));
?>
" onclick="return false;" title="<?php
echo esc_attr(get_bloginfo('name', 'display'));
?>
" rel="home"><?php
bloginfo('name');
?>
</a></span>
<span class="site-description"><?php
bloginfo('description');
?>
</span>
</div><!-- end of #logo -->
<?php
}
// header image was removed (again)
?>
</div>
<?php
}
示例11: igthemes_header_branding
function igthemes_header_branding()
{
?>
<div class="site-branding col12">
<?php
if (get_header_image()) {
?>
<img src="<?php
header_image();
?>
" width="<?php
echo get_custom_header()->width;
?>
" height="<?php
echo get_custom_header()->height;
?>
" class="header-image">
<?php
}
// End header image check.
?>
<?php
if (igthemes_get_option('logo')) {
?>
<a href="<?php
echo esc_url(home_url('/'));
?>
" id="site-logo" title="<?php
echo esc_attr(get_bloginfo('name', 'display'));
?>
" rel="home">
<img src="<?php
echo esc_url(igthemes_get_option('logo'));
?>
" alt="<?php
echo esc_attr(bloginfo('name'));
?>
"></a>
<?php
} else {
?>
<h1 class="site-title">
<a href="<?php
echo esc_url(home_url('/'));
?>
" rel="home"><?php
bloginfo('name');
?>
</a>
</h1>
<?php
}
?>
</div><!-- .site-branding -->
<?php
}
示例12: adelle_theme_heading
function adelle_theme_heading()
{
if (get_header_image() == true) {
?>
<a href="<?php
echo esc_url(home_url());
?>
">
<img src="<?php
header_image();
?>
" class="header-title" height="<?php
echo get_custom_header()->height;
?>
" width="<?php
echo get_custom_header()->width;
?>
" alt="<?php
bloginfo('name');
?>
" title="<?php
bloginfo('name');
?>
" />
</a>
<?php
} elseif (is_home() || is_front_page()) {
?>
<h1><a href="<?php
echo esc_url(home_url());
?>
" class="header-title"><?php
bloginfo('name');
?>
</a></h1>
<p class="header-desc"><?php
bloginfo('description');
?>
</p>
<?php
} else {
?>
<h5><a href="<?php
echo esc_url(home_url());
?>
" class="header-title"><?php
bloginfo('name');
?>
</a></h5>
<p class="header-desc"><?php
bloginfo('description');
?>
</p>
<?php
}
}
示例13: ubersmake_custom_header_setup
function ubersmake_custom_header_setup()
{
$args = array('default-image' => '%2$s/images/headers/atrium.jpg', 'default-text-color' => '000', 'width' => apply_filters('pilcrow_header_image_width', 990), 'height' => apply_filters('pilcrow_header_image_height', 257), 'wp-head-callback' => 'pilcrow_header_style', 'admin-head-callback' => 'pilcrow_admin_header_style', 'admin-preview-callback' => 'pilcrow_admin_header_image');
$options = pilcrow_get_theme_options();
if (in_array($options['theme_layout'], array('content-sidebar', 'sidebar-content'))) {
$args['width'] = apply_filters('pilcrow_header_image_width', 770);
$args['height'] = apply_filters('pilcrow_header_image_height', 200);
}
add_theme_support('custom-header', apply_filters('pilcrow_custom_header_args', $args));
set_post_thumbnail_size(get_custom_header()->width, get_custom_header()->height, true);
register_default_headers(array('atrium' => array('url' => '%2$s/images/headers/atrium.jpg', 'thumbnail_url' => '%2$s/images/headers/atrium-thumbnail.jpg', 'description' => _x('Atrium', 'Header image description', 'ubersmake'), 'source' => 'https://www.flickr.com/photos/ubersmake/14967126893/'), 'cafe' => array('url' => '%2$s/images/headers/cafe.jpg', 'thumbnail_url' => '%2$s/images/headers/cafe-thumbnail.jpg', 'description' => _x('Cafe', 'Header image description', 'ubersmake'), 'source' => 'https://www.flickr.com/photos/ubersmake/15836437415/'), 'causeway' => array('url' => '%2$s/images/headers/causeway.jpg', 'thumbnail_url' => '%2$s/images/headers/causeway-thumbnail.jpg', 'description' => _x('Causeway', 'Header image description', 'ubersmake'), 'source' => 'https://www.flickr.com/photos/ubersmake/14975660961/'), 'edinburgh' => array('url' => '%2$s/images/headers/edinburgh.jpg', 'thumbnail_url' => '%2$s/images/headers/edinburgh-thumbnail.jpg', 'description' => _x('edinburgh', 'Header image description', 'ubersmake'), 'source' => 'https://www.flickr.com/photos/ubersmake/15062454096/'), 'paris' => array('url' => '%2$s/images/headers/paris.jpg', 'thumbnail_url' => '%2$s/images/headers/paris-thumbnail.jpg', 'description' => _x('Paris', 'Header image description', 'ubersmake'), 'source' => 'https://www.flickr.com/photos/ubersmake/15174505258/')));
}
示例14: wp_enqueue_scripts
/**
* Enqueue our custom header styles/scripts
*
* @access public
*/
function wp_enqueue_scripts()
{
$hero = '#homepage-hero {';
$hero .= 'background-image:url(' . get_custom_header()->url . ');';
$hero .= 'background-color:' . get_theme_mod('header_bg_color') . ';';
$hero .= 'padding: 1.25rem 0;';
$hero .= 'margin: -2rem 0 2rem;';
$hero .= 'position: relative;';
$hero .= 'text-align: left;';
$hero .= 'height: auto;';
$hero .= '}';
$hero .= '#homepage-hero h1 a, #homepage-hero h4 {color:#' . get_header_textcolor() . '}';
wp_add_inline_style('app-css', $hero);
}
示例15: cleansimplewhite_header_style
function cleansimplewhite_header_style()
{
$header_image = get_header_image();
?>
<style>
#header a:link,
#header a:visited {
color: <?php
echo get_theme_mod('header_link_color');
?>
!important;
}
#header div {
color: <?php
echo get_theme_mod('header_text_color');
?>
!important;
}
<?php
if (!empty($header_image)) {
?>
#header {
background-image: url(<?php
echo $header_image;
?>
);
height: <?php
echo get_custom_header()->height;
?>
px;
}
<?php
}
?>
<?php
if (!display_header_text()) {
?>
#header * {
text-indent: -9999px;
}
<?php
}
?>
</style>
<?php
}