Ejemplo n.º 1
0
<?php

if ('1c' !== hybrid_get_theme_layout()) {
    // If not a one-column layout.
    ?>

	<aside <?php 
    hybrid_attr('sidebar', 'primary');
    ?>
>

		<?php 
    if (is_active_sidebar('primary')) {
        // If the sidebar has widgets.
        ?>

			<?php 
        dynamic_sidebar('primary');
        // Displays the primary sidebar.
        ?>

		<?php 
    } else {
        // If the sidebar has no widgets.
        ?>

			<?php 
        the_widget('WP_Widget_Text', array('title' => __('Example Widget', '<%= themeSlug %>'), 'text' => sprintf(__('This is an example widget to show how the Primary sidebar looks by default. You can add custom widgets from the %swidgets screen%s in the admin.', '<%= themeSlug %>'), current_user_can('edit_theme_options') ? '<a href="' . admin_url('widgets.php') . '">' : '', current_user_can('edit_theme_options') ? '</a>' : ''), 'filter' => true), array('before_widget' => '<section class="widget widget_text">', 'after_widget' => '</section>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));
        ?>

		<?php 
Ejemplo n.º 2
0
<?php

if (!in_array(hybrid_get_theme_layout(), array('1c', '1c-narrow'))) {
    ?>

	<aside class="sidebar-primary sidebar" role="complementary" aria-label="Primary Sidebar" itemscope="itemscope" itemtype="http://schema.org/WPSideBar">

		<?php 
    if (is_active_sidebar('primary')) {
        // If the sidebar has widgets.
        ?>

			<?php 
        dynamic_sidebar('primary');
        // Displays the primary sidebar.
        ?>

		<?php 
    } else {
        // If the sidebar has no widgets.
        ?>

			<?php 
        the_widget('WP_Widget_Text', array('title' => __('Example Widget', 'melange'), 'text' => sprintf(__('This is an example widget to show how the Primary sidebar looks by default. You can add custom widgets from the %swidgets screen%s in the admin.', 'melange'), current_user_can('edit_theme_options') ? '<a href="' . admin_url('widgets.php') . '">' : '', current_user_can('edit_theme_options') ? '</a>' : ''), 'filter' => true), array('before_widget' => '<section class="widget widget_text">', 'after_widget' => '</section>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));
        ?>

		<?php 
    }
    // End widgets check.
    ?>
Ejemplo n.º 3
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);
}
Ejemplo n.º 4
0
<?php

if (!in_array(hybrid_get_theme_layout(), array('1c'))) {
    ?>

	<aside class="sidebar-primary sidebar" role="complementary" aria-label="Primary Sidebar" itemscope="itemscope" itemtype="http://schema.org/WPSideBar">

		<?php 
    if (is_active_sidebar('primary')) {
        // If the sidebar has widgets.
        ?>

			<?php 
        dynamic_sidebar('primary');
        // Displays the primary sidebar.
        ?>

		<?php 
    } else {
        // If the sidebar has no widgets.
        ?>

			<?php 
        the_widget('WP_Widget_Text', array('title' => __('Example Widget', 'marsh'), 'text' => sprintf(__('This is an example widget to show how the Primary sidebar looks by default. You can add custom widgets from the %swidgets screen%s in the admin.', 'marsh'), current_user_can('edit_theme_options') ? '<a href="' . admin_url('widgets.php') . '">' : '', current_user_can('edit_theme_options') ? '</a>' : ''), 'filter' => true), array('before_widget' => '<section class="widget widget_text">', 'after_widget' => '</section>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));
        ?>

		<?php 
    }
    // End widgets check.
    ?>