示例#1
0
	<?php 
    tha_sidebars_before();
    ?>

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

		<?php 
    tha_sidebar_top();
    ?>

		<span id="sidebar-primary-title" class="screen-reader-text"><?php 
    // Translators: %s is the sidebar name. This is the sidebar title shown to screen readers.
    printf(_x('%s', 'sidebar title', 'compass'), hybrid_get_sidebar_name('primary'));
    ?>
</span>

		<?php 
    if (is_active_sidebar('primary')) {
        ?>

			<?php 
        dynamic_sidebar('primary');
        ?>

		<?php 
    } else {
        ?>
示例#2
0
/**
 * Sidebar attributes.
 *
 * @since  2.0.0
 * @access public
 * @param  array   $attr
 * @param  string  $context
 * @return array
 */
function hybrid_attr_sidebar($attr, $context)
{
    if (!empty($context)) {
        $attr['id'] = "sidebar-{$context}";
    }
    $attr['class'] = 'sidebar';
    $attr['role'] = 'complementary';
    if (!empty($context)) {
        /* Translators: The %s is the sidebar name. This is used for the 'aria-label' attribute. */
        $attr['aria-label'] = esc_attr(sprintf(_x('%s Sidebar', 'sidebar aria label', 'hybrid-core'), hybrid_get_sidebar_name($context)));
    }
    $attr['itemscope'] = 'itemscope';
    $attr['itemtype'] = 'http://schema.org/WPSideBar';
    return $attr;
}
示例#3
0
<?php

if (!in_array(get_theme_mod('theme_layout'), array('1c', '1c-narrow'))) {
    // If not a one-column layout.
    ?>

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

		<h3 id="sidebar-primary-title" class="screen-reader-text"><?php 
    // Translators: %s is the sidebar name. This is the sidebar title shown to screen readers.
    printf(_x('%s Sidebar', 'sidebar title', 'stargazer'), hybrid_get_sidebar_name('primary'));
    ?>
</h3>

		<?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.
        ?>