예제 #1
0
/**
 * 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 '.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-standard" : "{$post->post_type}-format-{$post_format}";
        }
        // 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 (!empty($class)) {
        $class = is_array($class) ? $class : preg_split('#\\s+#', $class);
        $classes = array_merge($classes, $class);
    }
    return array_map('esc_attr', $classes);
}
예제 #2
0
?>

	<div id="primary" class="content-area">

		<main class="site-main" <?php 
hybrid_attr('content');
?>
>

		<?php 
hybrid_get_menu('secondary');
// Loads the menu/secondary.php template.
?>

		<?php 
if (!is_front_page() && hybrid_is_plural()) {
    // If viewing a multi-post page
    ?>

			<?php 
    locate_template(array('misc/archive-header.php'), true);
    // Loads the misc/archive-header.php template.
    ?>

		<?php 
}
// End check for multi-post page.
?>

		<?php 
do_action('theone_content_top');
예제 #3
0
파일: index.php 프로젝트: EJOweb/ejoweb
// Loads the header.php template.
?>

<main <?php 
hybrid_attr('content');
?>
>

	<?php 
hybrid_get_menu('breadcrumbs');
// Loads the menu/breadcrumbs.php template.
?>
	
	
	<?php 
if (hybrid_is_plural()) {
    ?>

		<?php 
    locate_template(array('misc/archive-header.php'), true);
    // Loads the misc/archive-header.php template.
    ?>

	<?php 
}
?>

	<?php 
if (have_posts()) {
    // Checks if any posts were found.
    ?>