本文整理汇总了PHP中has_custom_logo函数的典型用法代码示例。如果您正苦于以下问题:PHP has_custom_logo函数的具体用法?PHP has_custom_logo怎么用?PHP has_custom_logo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了has_custom_logo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: siteorigin_north_display_logo
/**
* Display the logo or site title
*/
function siteorigin_north_display_logo()
{
$logo = siteorigin_setting('branding_logo');
if (!empty($logo)) {
$attrs = apply_filters('siteorigin_north_logo_attributes', array());
?>
<a href="<?php
echo esc_url(home_url('/'));
?>
" rel="home">
<span class="screen-reader-text"><?php
esc_html_e('Home', 'siteorigin-north');
?>
</span><?php
echo wp_get_attachment_image($logo, 'full', false, $attrs);
?>
</a><?php
} elseif (function_exists('has_custom_logo') && has_custom_logo()) {
the_custom_logo();
} else {
if (is_front_page()) {
?>
<h1 class="site-title"><a href="<?php
echo esc_url(home_url('/'));
?>
" rel="home"><?php
bloginfo('name');
?>
</a></h1>
<?php
} else {
?>
<p class="site-title"><a href="<?php
echo esc_url(home_url('/'));
?>
" rel="home"><?php
bloginfo('name');
?>
</a></p>
<?php
}
}
}
示例2: reach_site_identity
/**
* Displays the site identity section.
*
* This may include the logo, site title and/or site tagline.
*
* @param boolean $echo
* @return string
* @since 1.0.0
*/
function reach_site_identity($echo = true)
{
$output = '';
$home_url = home_url();
$site_title = get_bloginfo('name');
$hide_title = (bool) get_theme_mod('hide_site_title');
$hide_tagline = (bool) get_theme_mod('hide_site_tagline');
if (function_exists('has_custom_logo') && has_custom_logo()) {
$output .= get_custom_logo();
}
$tag = is_front_page() ? 'h1' : 'div';
$output .= apply_filters('reach_site_title', sprintf('<%s class="site-title %s"><a href="%s" title="%s">%s</a></%s>', $tag, $hide_title ? 'hidden' : '', $home_url, __('Go to homepage', 'reach'), $site_title, $tag));
$output .= apply_filters('reach_site_tagline', sprintf('<div class="site-tagline %s">%s</div>', $hide_tagline ? 'hidden' : '', get_bloginfo('description')));
if (!$echo) {
return $output;
}
echo $output;
}
示例3: skin_logo_upload_area
function skin_logo_upload_area()
{
?>
<div class="logo">
<?php
if (has_custom_logo()) {
the_custom_logo();
} else {
if (is_home()) {
?>
<h1 class='site-title'>
<a href='<?php
echo esc_url(home_url('/'));
?>
' title='<?php
echo esc_attr(get_bloginfo('name', 'display'));
?>
' rel='home'> <?php
bloginfo('name');
?>
</a>
</h1>
<p><a href='<?php
echo esc_url(home_url('/'));
?>
' title='<?php
echo esc_attr(get_bloginfo('description', 'display'));
?>
' rel='home'> <?php
bloginfo('description');
?>
</a></p>
<?php
} else {
?>
<h2 class='site-title'>
<a href='<?php
echo esc_url(home_url('/'));
?>
' title='<?php
echo esc_attr(get_bloginfo('name', 'display'));
?>
' rel='home'> <?php
bloginfo('name');
?>
</a></h2>
<p><a href='<?php
echo esc_url(home_url('/'));
?>
' title='<?php
echo esc_attr(get_bloginfo('description', 'display'));
?>
' rel='home'> <?php
bloginfo('description');
?>
</a></p>
<?php
}
}
?>
</div>
<?php
}
示例4: natural_lite_custom_logo
function natural_lite_custom_logo()
{
if (function_exists('the_custom_logo') && has_custom_logo()) {
if (is_front_page() && is_home()) {
?>
<h1 class="site-logo"><?php
the_custom_logo();
?>
</h1>
<?php
} else {
?>
<p class="site-logo"><?php
the_custom_logo();
?>
</p>
<?php
}
} else {
if (is_front_page() && is_home()) {
?>
<h1 class="site-title">
<a href="<?php
echo esc_url(home_url('/'));
?>
" rel="home"><?php
echo wp_kses_post(get_bloginfo('name'));
?>
</a>
</h1>
<?php
} else {
?>
<p class="site-title">
<a href="<?php
echo esc_url(home_url('/'));
?>
" rel="home"><?php
echo wp_kses_post(get_bloginfo('name'));
?>
</a>
</p>
<?php
}
}
}
示例5: jkl_split_main_nav
$split_nav = jkl_split_main_nav('primary', false);
echo $split_nav->left_menu;
echo $split_nav->right_menu;
} else {
echo '<em class="menu-warning">' . __('Please select a menu for your primary navigation.', 'jkl') . '</em>';
}
?>
</div>
<?php
}
// The next menu is the FULL navigation menu, original from Underscores, using TwentyFifteen toggles - shown on tablets and mobile devices
?>
<div class="full-navigation-menu <?php
echo has_custom_logo() ? 'hide-for-large' : 'split-navigation-menu';
?>
">
<?php
wp_nav_menu(array('theme_location' => 'primary', 'menu_id' => 'primary-menu', 'menu_class' => 'nav-menu'));
?>
</div>
</nav><!-- #site-navigation -->
</div><!-- .top-bar-center NON-Foundation -->
</div><!-- #primary-nav-bar -->
<?php
if (has_nav_menu('social')) {
?>
示例6: language_attributes
language_attributes();
?>
>
<head>
<title><?php
wp_title('');
?>
</title>
<meta http-equiv="Content-Type" content="<?php
bloginfo('html_type');
?>
; charset=<?php
bloginfo('charset');
?>
" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<?php
wp_head();
?>
</head>
<body <?php
body_class($smooth_scroll_class);
?>
>
<?php
if (has_custom_logo() || has_nav_menu('primary')) {
get_template_part('theme/partials/nav');
}
?>
<main>
示例7: bloginfo
<div class="navbar-header col-md-3">
<!-- .navbar-toggle is used as the toggle for collapsed navbar content -->
<button class="navbar-toggle hidden-sm-up" type="button" data-toggle="collapse" data-target=".exCollapsingNavbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- Your site title as branding in the menu -->
<?php
if (!has_custom_logo()) {
?>
<a class="navbar-brand" href="<?php
echo esc_url(home_url('/'));
?>
" title="<?php
echo esc_attr(get_bloginfo('name', 'display'));
?>
" rel="home">
<?php
bloginfo('name');
?>
</a>
<?php
} else {
the_custom_logo();
示例8: get_site_url
echo get_site_url();
?>
">
<?php
the_custom_logo();
?>
</a>
</div>
<?php
}
?>
<?php
if (has_nav_menu('primary')) {
?>
<div class="column <?php
echo has_custom_logo() ? 'xs-span4 sm-span6 md-span8 lg-span9' : 'xs-span12';
?>
">
<?php
$args = array('theme_location' => 'primary', 'menu' => '', 'container' => 'div', 'container_id' => 'nav-menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'items_wrap' => '<ul id="%1$s">%3$s</ul>', 'depth' => 0, 'walker' => '');
wp_nav_menu($args);
$args = array('theme_location' => 'primary', 'menu' => '', 'container' => 'div', 'container_id' => 'dl-menu', 'container_class' => 'dl-menuwrapper', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'items_wrap' => '<button class="dl-trigger">Open Menu</button><ul class="dl-menu">%3$s</ul>', 'depth' => 0, 'walker' => '');
wp_nav_menu($args);
?>
</div>
<?php
}
?>
</div>
</nav>
示例9: hybrid_body_class_filter
/**
* Filters the WordPress body class with a better set of classes that are more consistently handled and
* are backwards compatible with the original body class functionality that existed prior to WordPress
* core adopting this feature.
*
* @since 2.0.0
* @access public
* @param array $classes
* @param string|array $class
* @return array
*/
function hybrid_body_class_filter($classes, $class)
{
// WordPress class for uses when WordPress isn't always the only system on the site.
$classes = array('wordpress');
// Text direction.
$classes[] = is_rtl() ? 'rtl' : 'ltr';
// Locale and language.
$locale = get_locale();
$lang = hybrid_get_language($locale);
if ($locale !== $lang) {
$classes[] = $lang;
}
$classes[] = strtolower(str_replace('_', '-', $locale));
// Check if the current theme is a parent or child theme.
$classes[] = is_child_theme() ? 'child-theme' : 'parent-theme';
// Multisite check adds the 'multisite' class and the blog ID.
if (is_multisite()) {
$classes[] = 'multisite';
$classes[] = 'blog-' . get_current_blog_id();
}
// Date classes.
$time = time() + get_option('gmt_offset') * 3600;
$classes[] = strtolower(gmdate('\\yY \\mm \\dd \\hH l', $time));
// Is the current user logged in.
$classes[] = is_user_logged_in() ? 'logged-in' : 'logged-out';
// WP admin bar.
if (is_admin_bar_showing()) {
$classes[] = 'admin-bar';
}
// Use the '.custom-background' class to integrate with the WP background feature.
if (get_background_image() || get_background_color()) {
$classes[] = 'custom-background';
}
// Add the '.custom-header' class if the user is using a custom header.
if (get_header_image() || display_header_text() && get_header_textcolor()) {
$classes[] = 'custom-header';
}
// Add the `.custom-logo` class if user is using a custom logo.
if (function_exists('has_custom_logo') && has_custom_logo()) {
$classes[] = 'wp-custom-logo';
}
// Add the '.display-header-text' class if the user chose to display it.
if (display_header_text()) {
$classes[] = 'display-header-text';
}
// Plural/multiple-post view (opposite of singular).
if (hybrid_is_plural()) {
$classes[] = 'plural';
}
// Merge base contextual classes with $classes.
$classes = array_merge($classes, hybrid_get_context());
// Singular post (post_type) classes.
if (is_singular()) {
// Get the queried post object.
$post = get_queried_object();
// Checks for custom template.
$template = str_replace(array("{$post->post_type}-template-", "{$post->post_type}-"), '', basename(hybrid_get_post_template($post->ID), '.php'));
if ($template) {
$classes[] = "{$post->post_type}-template-{$template}";
}
// Post format.
if (current_theme_supports('post-formats') && post_type_supports($post->post_type, 'post-formats')) {
$post_format = get_post_format(get_queried_object_id());
$classes[] = $post_format && !is_wp_error($post_format) ? "{$post->post_type}-format-{$post_format}" : "{$post->post_type}-format-standard";
}
// Attachment mime types.
if (is_attachment()) {
foreach (explode('/', get_post_mime_type()) as $type) {
$classes[] = "attachment-{$type}";
}
}
}
// Paged views.
if (is_paged()) {
$classes[] = 'paged';
$classes[] = 'paged-' . intval(get_query_var('paged'));
} elseif (is_singular() && 1 < get_query_var('page')) {
$classes[] = 'paged';
$classes[] = 'paged-' . intval(get_query_var('page'));
}
// Theme layouts.
if (current_theme_supports('theme-layouts')) {
$classes[] = sanitize_html_class('layout-' . hybrid_get_theme_layout());
}
// Input class.
if ($class) {
$class = is_array($class) ? $class : preg_split('#\\s+#', $class);
$classes = array_merge($classes, $class);
}
//.........这里部分代码省略.........
示例10: test_has_custom_logo_preserves_switched_state
/**
* @ticket 38253
*/
function test_has_custom_logo_preserves_switched_state()
{
if (!is_multisite()) {
$this->markTestSkipped('This test requires multisite.');
}
$blog_id = $this->factory->blog->create();
switch_to_blog($blog_id);
$expected = $GLOBALS['_wp_switched_stack'];
has_custom_logo($blog_id);
$result = $GLOBALS['_wp_switched_stack'];
restore_current_blog();
$this->assertSame($expected, $result);
}
示例11: jinn_the_site_logo
<header id="masthead" class="group site-header title-bar top-bar" role="banner" data-sticky data-options="marginTop:0;" style="width:100%" data-top-anchor="masthead" data-btm-anchor="colophon:bottom">
<div class="row"> <!-- Start Foundation row -->
<div class="top-bar-title">
<!-- <div class="title-bar" data-responsive-toggle="example-menu" data-hide-for="large">
<button class="menu-icon" type="button" data-toggle></button>
<div class="title-bar-title">Menu</div>
</div>-->
<div class="site-branding">
<?php
if (has_custom_logo() || jetpack_has_site_logo()) {
jinn_the_site_logo();
}
if (!has_custom_logo() && !jetpack_has_site_logo() || has_custom_logo() && get_theme_mod('show_logo_sitename') === true) {
?>
<?php
if (is_front_page() || is_home() || is_page_template('page-templates/frontpage-portfolio.php')) {
?>
<h1 class="site-title"><a href="<?php
echo esc_url(home_url('/'));
?>
" rel="home"><?php
bloginfo('name');
?>
</a></h1>
<?php
} else {
?>
示例12: rock_has_custom_logo
/**
* Check if the site has a custom logo.
*
* @since 1.0.0
*
* @return bool
*/
function rock_has_custom_logo()
{
/**
* For backwards compatibility prior to WordPress 4.5.
*
* @link https://developer.wordpress.org/reference/functions/has_custom_logo/
* @since 1.0.0
*/
$enabled = function_exists('has_custom_logo') ? has_custom_logo() : (bool) get_theme_mod('custom_logo');
/**
* Filter if the site has a custom logo.
*
* @since 1.0.0
*
* @var bool
*/
return (bool) apply_filters('rock_has_custom_logo', $enabled);
}
示例13: focus_display_logo
/**
* Render the theme logo.
*/
function focus_display_logo()
{
$logo = siteorigin_setting('general_logo');
$retina_logo = siteorigin_setting('general_retina_logo');
if (empty($logo)) {
if (function_exists('has_custom_logo') && has_custom_logo()) {
the_custom_logo();
return;
} else {
// Just display the site title
bloginfo('name');
return;
}
}
$image = wp_get_attachment_image_src($logo, 'full');
if (siteorigin_setting('general_logo_scale')) {
$height = min($image[2], 26);
$width = $height / $image[1] * $image[2];
} else {
$height = $image[2];
$width = $image[1];
}
if ($retina_logo) {
$image_2x = wp_get_attachment_image_src($retina_logo, 'full');
$srcset = 'srcset="' . $image[0] . ' 1x, ' . $image_2x[0] . ' 2x"';
}
// echo $image;
?>
<img src="<?php
echo $image[0];
?>
" <?php
echo $srcset;
?>
width="<?php
echo round($width);
?>
" height="<?php
echo round($height);
?>
" /><?php
}
示例14: vantage_display_logo
/**
* Display the logo
*/
function vantage_display_logo()
{
$logo = siteorigin_setting('logo_image');
$logo = apply_filters('vantage_logo_image_id', $logo);
if (empty($logo)) {
if (function_exists('has_custom_logo') && has_custom_logo()) {
the_custom_logo();
return;
}
// Just display the site title
$logo_html = '<h1 class="site-title">' . get_bloginfo('name') . '</h1>';
$logo_html = apply_filters('vantage_logo_text', $logo_html);
} else {
// load the logo image
if (is_array($logo)) {
list($src, $height, $width) = $logo;
} else {
$image = wp_get_attachment_image_src($logo, 'full');
$src = $image[0];
$height = $image[2];
$width = $image[1];
}
// Add all the logo attributes
$logo_attributes = apply_filters('vantage_logo_image_attributes', array('src' => $src, 'class' => siteorigin_setting('logo_in_menu_constrain') ? 'logo-height-constrain' : 'logo-no-height-constrain', 'width' => round($width), 'height' => round($height), 'alt' => sprintf(__('%s Logo', 'vantage'), get_bloginfo('name'))));
// Try adding the retina logo
$retina_logo = siteorigin_setting('logo_image_retina');
if (!empty($retina_logo)) {
$retina_logo = apply_filters('vantage_logo_retina_image_id', $retina_logo);
$retina_logo_image = wp_get_attachment_image_src($retina_logo, 'full');
if (!empty($retina_logo_image[0])) {
$logo_attributes['srcset'] = $retina_logo_image[0] . ' 2x';
}
}
if ($logo_attributes['width'] > vantage_get_site_width()) {
// Don't let the width be more than the site width.
$width = vantage_get_site_width();
$logo_attributes['height'] = round($logo_attributes['height'] / ($logo_attributes['width'] / $width));
$logo_attributes['width'] = $width;
}
$logo_attributes_str = array();
if (!empty($logo_attributes)) {
foreach ($logo_attributes as $name => $val) {
if (empty($val)) {
continue;
}
$logo_attributes_str[] = $name . '="' . esc_attr($val) . '" ';
}
}
$logo_html = apply_filters('vantage_logo_image', '<img ' . implode(' ', $logo_attributes_str) . ' />');
}
// Echo the image
echo apply_filters('vantage_logo_html', $logo_html);
}
示例15: origami_header_image
function origami_header_image()
{
if (function_exists('has_custom_logo') && has_custom_logo()) {
$logo = get_custom_logo();
if (!empty($logo)) {
echo $logo;
return true;
}
}
if (function_exists('has_header_image') && has_header_image()) {
$header = get_custom_header();
echo '<img src="' . esc_url($header->url) . '"';
if (!empty($header->height)) {
echo ' height="' . $header->height . '"';
}
if (!empty($header->width)) {
echo ' width="' . $header->width . '"';
}
echo ' alt="' . esc_attr(get_bloginfo('name')) . '" />';
return true;
}
return false;
}