コード例 #1
0
/**
 * Adds custom classes to the array of body classes.
 *
 * @param array $classes Classes for the body element.
 * @return array
 */
function twentyseventeen_body_classes($classes)
{
    // Add class of group-blog to blogs with more than 1 published author.
    if (is_multi_author()) {
        $classes[] = 'group-blog';
    }
    // Add class of hfeed to non-singular pages.
    if (!is_singular()) {
        $classes[] = 'hfeed';
    }
    // Add class if we're viewing the Customizer for easier styling of theme options.
    if (is_customize_preview()) {
        $classes[] = 'twentyseventeen-customizer';
    }
    // Add class on front page.
    if (is_front_page() && 'posts' !== get_option('show_on_front')) {
        $classes[] = 'twentyseventeen-front-page';
    }
    // Add a class if there is a custom header.
    if (has_header_image() || has_header_video() && is_front_page()) {
        $classes[] = 'has-header-image';
    }
    // Add class if sidebar is used.
    if (is_active_sidebar('sidebar-1') && !is_page()) {
        $classes[] = 'has-sidebar';
    }
    // Add class for one or two column page layouts.
    if (is_page() || is_archive()) {
        if ('one-column' === get_theme_mod('page_layout')) {
            $classes[] = 'page-one-column';
        } else {
            $classes[] = 'page-two-column';
        }
    }
    // Add class if the site title and tagline is hidden.
    if ('blank' === get_header_textcolor()) {
        $classes[] = 'title-tagline-hidden';
    }
    // Get the colorscheme or the default if there isn't one.
    $colors = twentyseventeen_sanitize_colorscheme(get_theme_mod('colorscheme', 'light'));
    $classes[] = 'colors-' . $colors;
    return $classes;
}
コード例 #2
0
/**
 * Print the markup for a custom header.
 *
 * A container div will always be printed in the Customizer preview.
 *
 * @since 4.7.0
 */
function the_custom_header_markup()
{
    $custom_header = get_custom_header_markup();
    if (empty($custom_header)) {
        return;
    }
    echo $custom_header;
    if (is_front_page() && (has_header_video() || is_customize_preview())) {
        wp_enqueue_script('wp-custom-header');
        wp_localize_script('wp-custom-header', '_wpCustomHeaderSettings', get_header_video_settings());
    }
}
コード例 #3
0
ファイル: header.php プロジェクト: 023yangbo/WordPress
echo get_template_directory_uri();
?>
/js/html5.js"></script>
	<![endif]-->
	<?php 
wp_head();
?>
</head>

<body <?php 
body_class();
?>
>
<div id="page" class="hfeed site">
	<?php 
if (function_exists('has_header_video') && has_header_video()) {
    ?>
		<div id="site-header">
			<?php 
    the_custom_header_markup();
    ?>
		</div>
	<?php 
} elseif (get_header_image()) {
    ?>
	<div id="site-header">
		<a href="<?php 
    echo esc_url(home_url('/'));
    ?>
" rel="home">
			<img src="<?php 
コード例 #4
0
ファイル: functions.php プロジェクト: 023yangbo/WordPress
/**
 * Extend the default WordPress body classes.
 *
 * Adds body classes to denote:
 * 1. Single or multiple authors.
 * 2. Presence of header image except in Multisite signup and activate pages.
 * 3. Index views.
 * 4. Full-width content layout.
 * 5. Presence of footer widgets.
 * 6. Single views.
 * 7. Featured content layout.
 *
 * @since Twenty Fourteen 1.0
 *
 * @param array $classes A list of existing body class values.
 * @return array The filtered body class list.
 */
function twentyfourteen_body_classes($classes)
{
    if (is_multi_author()) {
        $classes[] = 'group-blog';
    }
    if (get_header_image() || function_exists('has_header_video') && has_header_video()) {
        $classes[] = 'header-image';
    } elseif (!in_array($GLOBALS['pagenow'], array('wp-activate.php', 'wp-signup.php'))) {
        $classes[] = 'masthead-fixed';
    }
    if (is_archive() || is_search() || is_home()) {
        $classes[] = 'list-view';
    }
    if (!is_active_sidebar('sidebar-2') || is_page_template('page-templates/full-width.php') || is_page_template('page-templates/contributors.php') || is_attachment()) {
        $classes[] = 'full-width';
    }
    if (is_active_sidebar('sidebar-3')) {
        $classes[] = 'footer-widgets';
    }
    if (is_singular() && !is_front_page()) {
        $classes[] = 'singular';
    }
    if (is_front_page() && 'slider' == get_theme_mod('featured_content_layout')) {
        $classes[] = 'slider';
    } elseif (is_front_page()) {
        $classes[] = 'grid';
    }
    return $classes;
}
コード例 #5
0
ファイル: theme.php プロジェクト: 023yangbo/WordPress
/**
 * Print the markup for a custom header.
 *
 * @since 4.7.0
 */
function the_custom_header_markup()
{
    if (!($custom_header = get_custom_header_markup())) {
        return;
    }
    echo $custom_header;
    if (has_header_video() && is_front_page()) {
        wp_enqueue_script('wp-custom-header');
        wp_localize_script('wp-custom-header', '_wpCustomHeaderSettings', get_header_video_settings());
    }
}