当前位置: 首页>>代码示例>>PHP>>正文


PHP genesis_a11y函数代码示例

本文整理汇总了PHP中genesis_a11y函数的典型用法代码示例。如果您正苦于以下问题:PHP genesis_a11y函数的具体用法?PHP genesis_a11y怎么用?PHP genesis_a11y使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了genesis_a11y函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: genesis_404

/**
 * This function outputs a 404 "Not Found" error message
 *
 * @since 1.6
 */
function genesis_404()
{
    echo genesis_html5() ? '<article class="entry">' : '<div class="post hentry">';
    printf('<h1 class="entry-title">%s</h1>', apply_filters('genesis_404_entry_title', __('Not found, error 404', 'genesis')));
    echo '<div class="entry-content">';
    if (genesis_html5()) {
        echo apply_filters('genesis_404_entry_content', '<p>' . sprintf(__('The page you are looking for no longer exists. Perhaps you can return back to the site\'s <a href="%s">homepage</a> and see if you can find what you are looking for. Or, you can try finding it by using the search form below.', 'genesis'), trailingslashit(home_url())) . '</p>');
        get_search_form();
    } else {
        ?>

			<p><?php 
        printf(__('The page you are looking for no longer exists. Perhaps you can return back to the site\'s <a href="%s">homepage</a> and see if you can find what you are looking for. Or, you can try finding it with the information below.', 'genesis'), trailingslashit(home_url()));
        ?>
</p>



	<?php 
    }
    if (!genesis_html5()) {
        genesis_sitemap('h4');
    } elseif (genesis_a11y('404-page')) {
        echo '<h2>' . __('Sitemap', 'genesis') . '</h2>';
        genesis_sitemap('h3');
    }
    echo '</div>';
    echo genesis_html5() ? '</article>' : '</div>';
}
开发者ID:Oak86,项目名称:matthewbuttler.work,代码行数:34,代码来源:404.php

示例2: genesis_a11y_more_link

/**
 * Return more link text plus hidden title for screen readers, to improve accessibility.
 *
 * @since 2.2.0
 *
 * @param string  $more_link_text Text of the more link.
 *
 * @return string $more_link_text with or withput the hidden title.
 */
function genesis_a11y_more_link($more_link_text)
{
    if (genesis_a11y('screen-reader-text') && !empty($more_link_text)) {
        $more_link_text .= ' <span class="screen-reader-text">' . __('about ', 'genesis') . get_the_title() . '</span>';
    }
    return $more_link_text;
}
开发者ID:Friends-School-Atlanta,项目名称:Deployable-WordPress,代码行数:16,代码来源:formatting.php

示例3: genesis_search_form

/**
 * Replace the default search form with a Genesis-specific form.
 *
 * The exact output depends on whether the child theme supports HTML5 or not.
 *
 * Applies the `genesis_search_text`, `genesis_search_button_text`, `genesis_search_form_label` and
 * `genesis_search_form` filters.
 *
 * @since 0.2.0
 *
 * @uses genesis_html5() Check for HTML5 support.
 *
 * @return string HTML markup.
 */
function genesis_search_form()
{
    $search_text = get_search_query() ? apply_filters('the_search_query', get_search_query()) : apply_filters('genesis_search_text', __('Search this website', 'genesis') . ' &#x02026;');
    $button_text = apply_filters('genesis_search_button_text', esc_attr__('Search', 'genesis'));
    $onfocus = "if ('" . esc_js($search_text) . "' === this.value) {this.value = '';}";
    $onblur = "if ('' === this.value) {this.value = '" . esc_js($search_text) . "';}";
    //* Empty label, by default. Filterable.
    $label = apply_filters('genesis_search_form_label', '');
    $value_or_placeholder = get_search_query() == '' ? 'placeholder' : 'value';
    if (genesis_html5()) {
        $form = sprintf('<form %s>', genesis_attr('search-form'));
        if (genesis_a11y('search-form')) {
            if ('' == $label) {
                $label = apply_filters('genesis_search_text', __('Search this website', 'genesis'));
            }
            $form_id = uniqid('searchform-');
            $form .= sprintf('<meta itemprop="target" content="%s"/><label class="search-form-label screen-reader-text" for="%s">%s</label><input itemprop="query-input" type="search" name="s" id="%s" %s="%s" /><input type="submit" value="%s" /></form>', home_url('/?s={s}'), esc_attr($form_id), esc_html($label), esc_attr($form_id), $value_or_placeholder, esc_attr($search_text), esc_attr($button_text));
        } else {
            $form .= sprintf('%s<meta itemprop="target" content="%s"/><input itemprop="query-input" type="search" name="s" %s="%s" /><input type="submit" value="%s"  /></form>', esc_html($label), home_url('/?s={s}'), $value_or_placeholder, esc_attr($search_text), esc_attr($button_text));
        }
    } else {
        $form = sprintf('<form method="get" class="searchform search-form" action="%s" role="search" >%s<input type="text" value="%s" name="s" class="s search-input" onfocus="%s" onblur="%s" /><input type="submit" class="searchsubmit search-submit" value="%s" /></form>', home_url('/'), esc_html($label), esc_attr($search_text), esc_attr($onfocus), esc_attr($onblur), esc_attr($button_text));
    }
    return apply_filters('genesis_search_form', $form, $search_text, $button_text, $label);
}
开发者ID:Oak86,项目名称:matthewbuttler.work,代码行数:39,代码来源:search.php

示例4: widget

 /**
  * Echo the widget content.
  *
  * @param array $args     Display arguments including `before_title`, `after_title`,
  *                        `before_widget`, and `after_widget`.
  * @param array $instance The settings for the particular instance of the widget.
  */
 function widget($args, $instance)
 {
     // Merge with defaults.
     $instance = wp_parse_args((array) $instance, $this->defaults);
     echo $args['before_widget'];
     if (!empty($instance['title'])) {
         echo $args['before_title'] . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $args['after_title'];
     }
     $text = '';
     if (!empty($instance['alignment'])) {
         $text .= '<span class="align' . esc_attr($instance['alignment']) . '">';
     }
     $text .= get_avatar($instance['user'], $instance['size']);
     if (!empty($instance['alignment'])) {
         $text .= '</span>';
     }
     if ('text' === $instance['author_info']) {
         $text .= $instance['bio_text'];
     } else {
         $text .= get_the_author_meta('description', $instance['user']);
     }
     $text .= $instance['page'] ? sprintf(' <a class="pagelink" href="%s">%s</a>', get_page_link($instance['page']), $instance['page_link_text']) : '';
     echo wpautop($text);
     // If posts link option checked, add posts link to output.
     $display_name = get_the_author_meta('display_name', $instance['user']);
     $user_name = !empty($display_name) && genesis_a11y('screen-reader-text') ? '<span class="screen-reader-text">' . $display_name . ': </span>' : '';
     if ($instance['posts_link']) {
         printf('<div class="posts_link posts-link"><a href="%s">%s%s</a></div>', get_author_posts_url($instance['user']), $user_name, __('View My Blog Posts', 'genesis'));
     }
     echo $args['after_widget'];
 }
开发者ID:netmagik,项目名称:netmagik,代码行数:38,代码来源:user-profile-widget.php

示例5: genesis_default_widget_area_content

/**
 * Template for default widget area content.
 *
 * @since 2.0.0
 *
 * @param string $name Name of the widget area e.g. `__( 'Secondary Sidebar Widget Area', 'yourtextdomain' )`.
 */
function genesis_default_widget_area_content($name)
{
    echo genesis_html5() ? '<section class="widget widget_text">' : '<div class="widget widget_text">';
    echo '<div class="widget-wrap">';
    $heading = genesis_a11y('headings') ? 'h3' : 'h4';
    echo sprintf('<%1$s class="widgettitle">%2$s</%1$s>', $heading, esc_html($name));
    echo '<div class="textwidget"><p>';
    printf(__('This is the %s. You can add content to this area by visiting your <a href="%s">Widgets Panel</a> and adding new widgets to this area.', 'genesis'), $name, admin_url('widgets.php'));
    echo '</p></div>';
    echo '</div>';
    echo genesis_html5() ? '</section>' : '</div>';
}
开发者ID:arobbins,项目名称:foodgroup,代码行数:19,代码来源:sidebar.php

示例6: genesis_do_nav

/**
 * Echo the "Primary Navigation" menu.
 *
 * Applies the `genesis_primary_nav` and legacy `genesis_do_nav` filters.
 *
 * @since 1.0.0
 *
 * @uses genesis_nav_menu() Display a navigation menu.
 * @uses genesis_nav_menu_supported() Checks for support of specific nav menu.
 * @uses genesis_a11y() Checks for acessibility support to add a heading to the main navigation.
 */
function genesis_do_nav()
{
    //* Do nothing if menu not supported
    if (!genesis_nav_menu_supported('primary') || !has_nav_menu('primary')) {
        return;
    }
    $class = 'menu genesis-nav-menu menu-primary';
    if (genesis_superfish_enabled()) {
        $class .= ' js-superfish';
    }
    if (genesis_a11y('headings')) {
        printf('<h2 class="screen-reader-text">%s</h2>', __('Main navigation', 'genesis'));
    }
    genesis_nav_menu(array('theme_location' => 'primary', 'menu_class' => $class));
}
开发者ID:Friends-School-Atlanta,项目名称:Deployable-WordPress,代码行数:26,代码来源:menu.php

示例7: genesis_load_scripts

/**
 * Enqueue the scripts used on the front-end of the site.
 *
 * Includes comment-reply, superfish and the superfish arguments.
 *
 * Applies the `genesis_superfish_enabled`, and `genesis_superfish_args_uri`. filter.
 *
 * @since 0.2.0
 *
 * @uses genesis_html5()      Check for HTML5 support.
 * @uses genesis_get_option() Get theme setting value.
 */
function genesis_load_scripts()
{
    //* If a single post or page, threaded comments are enabled, and comments are open
    if (is_singular() && get_option('thread_comments') && comments_open()) {
        wp_enqueue_script('comment-reply');
    }
    //* If superfish is enabled
    if (genesis_superfish_enabled()) {
        wp_enqueue_script('superfish');
        wp_enqueue_script('superfish-args');
        //* Load compatibility script if not running HTML5
        if (!genesis_html5()) {
            wp_enqueue_script('superfish-compat');
        }
    }
    //* If accessibility support enabled
    if (genesis_a11y('skip-links')) {
        wp_enqueue_script('skip-links');
    }
}
开发者ID:Friends-School-Atlanta,项目名称:Deployable-WordPress,代码行数:32,代码来源:load-scripts.php

示例8: widget

 /**
  * Echo the widget content.
  *
  * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
  * @param array $instance The settings for the particular instance of the widget
  */
 function widget($args, $instance)
 {
     // Merge with defaults
     $instance = wp_parse_args((array) $instance, $this->defaults);
     echo $args['before_widget'];
     if (!empty($instance['title'])) {
         echo $args['before_title'] . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $args['after_title'];
     }
     if ($instance['show_featured_image']) {
         $image_id = get_the_author_meta('displayfeaturedimagegenesis', $instance['user']);
         $image_src = wp_get_attachment_image_src($image_id, $instance['featured_image_size']);
         if ($image_src) {
             echo '<img src="' . esc_url($image_src[0]) . '" alt="' . esc_html(get_the_author_meta('display_name', $instance['user'])) . '" class="' . esc_attr($instance['featured_image_alignment']) . '" />';
         }
     }
     $text = '';
     if ($instance['show_gravatar']) {
         if (!empty($instance['gravatar_alignment'])) {
             $text .= '<span class="align' . esc_attr($instance['gravatar_alignment']) . '">';
         }
         $text .= get_avatar($instance['user'], $instance['size']);
         if (!empty($instance['gravatar_alignment'])) {
             $text .= '</span>';
         }
     }
     if ($instance['author_info']) {
         $text .= 'text' === $instance['author_info'] ? $instance['bio_text'] : get_the_author_meta('description', $instance['user']);
     }
     $text .= $instance['page'] ? sprintf(' <a class="pagelink" href="%s">%s</a>', get_page_link($instance['page']), $instance['page_link_text']) : '';
     // Echo $text
     echo wp_kses_post(wpautop($text));
     // If posts link option checked, add posts link to output
     $display_name = get_the_author_meta('display_name', $instance['user']);
     $user_name = !empty($display_name) && function_exists('genesis_a11y') && genesis_a11y() ? '<span class="screen-reader-text">' . $display_name . ': </span>' : '';
     if ($instance['posts_link'] && $instance['link_text']) {
         printf('<div class="posts_link posts-link"><a href="%s">%s%s</a></div>', esc_url(get_author_posts_url($instance['user'])), wp_kses_post($user_name), esc_attr($instance['link_text']));
     }
     echo $args['after_widget'];
 }
开发者ID:robincornett,项目名称:display-featured-image-genesis,代码行数:45,代码来源:displayfeaturedimagegenesis-author-widget.php

示例9: genesis_load_scripts

/**
 * Enqueue the scripts used on the front-end of the site.
 *
 * Includes comment-reply, superfish and the superfish arguments.
 *
 * Applies the `genesis_superfish_enabled`, and `genesis_superfish_args_uri`. filter.
 *
 * @since 0.2.0
 */
function genesis_load_scripts()
{
    global $wp_scripts;
    // If a single post or page, threaded comments are enabled, and comments are open.
    if (is_singular() && get_option('thread_comments') && comments_open()) {
        wp_enqueue_script('comment-reply');
    }
    // If superfish is enabled.
    if (genesis_superfish_enabled()) {
        wp_enqueue_script('superfish');
        wp_enqueue_script('superfish-args');
        // Load compatibility script if not running HTML5.
        if (!genesis_html5()) {
            wp_enqueue_script('superfish-compat');
        }
    }
    // If accessibility support enabled.
    if (genesis_a11y('skip-links')) {
        wp_enqueue_script('skip-links');
    }
    // HTML5 shiv.
    wp_enqueue_script('html5shiv');
    $wp_scripts->add_data('html5shiv', 'conditional', 'lt IE 9');
}
开发者ID:netmagik,项目名称:netmagik,代码行数:33,代码来源:load-scripts.php

示例10: genesis_do_posts_page_heading

/**
 * Add custom headline and description to assigned posts page.
 *
 * If we're not on a posts page, then nothing extra is displayed.
 *
 * @since 2.2.1
 *
 * @uses genesis_a11y() Check if a post type should potentially support an archive setting page.
 * @uses genesis_do_post_title() Get list of custom post types which need an archive settings page.
 *
 * @return null Return early if not on relevant posts page.
 */
function genesis_do_posts_page_heading()
{
    if (!genesis_a11y('headings')) {
        return;
    }
    $posts_page = get_option('page_for_posts');
    if (is_null($posts_page)) {
        return;
    }
    if (!is_home() || genesis_is_root_page()) {
        return;
    }
    printf('<div %s>', genesis_attr('posts-page-description'));
    printf('<h1 %s>%s</h1>', genesis_attr('archive-title'), get_the_title($posts_page));
    echo '</div>';
}
开发者ID:Friends-School-Atlanta,项目名称:Deployable-WordPress,代码行数:28,代码来源:archive.php

示例11: die

/**
 * Genesis Framework.
 *
 * WARNING: This file is part of the core Genesis Framework. DO NOT edit this file under any circumstances.
 * Please do all modifications in the form of a child theme.
 *
 * @package Genesis\Templates
 * @author  StudioPress
 * @license GPL-2.0+
 * @link    http://my.studiopress.com/themes/genesis/
 */
if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' === basename($_SERVER['SCRIPT_FILENAME'])) {
    die('Please do not load this page directly. Thanks!');
}
if (post_password_required()) {
    printf('<p class="alert">%s</p>', __('This post is password protected. Enter the password to view comments.', 'genesis'));
    return;
}
//* Output semantically correct header if accessibility is supported
if (genesis_a11y('headings')) {
    printf('<h2 class="screen-reader-text">%s</h2>', __('Reader Interactions', 'genesis'));
}
do_action('genesis_before_comments');
do_action('genesis_comments');
do_action('genesis_after_comments');
do_action('genesis_before_pings');
do_action('genesis_pings');
do_action('genesis_after_pings');
do_action('genesis_before_comment_form');
do_action('genesis_comment_form');
do_action('genesis_after_comment_form');
开发者ID:Oak86,项目名称:matthewbuttler.work,代码行数:31,代码来源:comments.php

示例12: posts_nav

 /**
  * Display numeric posts navigation (similar to WP-PageNavi)
  *
  * @since 0.2.3
  */
 function posts_nav()
 {
     if (is_singular()) {
         return;
         // do nothing
     }
     global $wp_query;
     // Stop execution if there's only 1 page
     if ($wp_query->max_num_pages <= 1) {
         return;
     }
     $paged = get_query_var('paged') ? absint(get_query_var('paged')) : 1;
     $max = intval($wp_query->max_num_pages);
     //  add current page to the array
     if ($paged >= 1) {
         $links[] = $paged;
     }
     //  add the pages around the current page to the array
     if ($paged >= 3) {
         $links[] = $paged - 1;
         $links[] = $paged - 2;
     }
     if ($paged + 2 <= $max) {
         $links[] = $paged + 2;
         $links[] = $paged + 1;
     }
     genesis_markup(array('html5' => '<div %s>', 'xhtml' => '<div class="navigation">', 'context' => 'archive-pagination'));
     $before_number = function_exists('genesis_a11y') && genesis_a11y('screen-reader-text') ? '<span class="screen-reader-text">' . __('Page ', 'artshow') . '</span>' : '';
     echo '<ul>';
     //  Previous Post Link
     if (get_previous_posts_link()) {
         printf('<li class="view_room">%s</li>' . "\n", get_previous_posts_link(__('<strong class="larr">&larr;</strong> Previous Room', 'artshow')));
     }
     // Link to first Page, plus ellipeses, if necessary
     if (!in_array(1, $links)) {
         $class = 1 == $paged ? ' class="active"' : '';
         printf('<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url(get_pagenum_link(1)), $before_number . '1');
         if (!in_array(2, $links)) {
             echo '<li class="pagination-omission">&#x02026;</li>' . "\n";
         }
     }
     //  Link to Current page, plus 2 pages in either direction (if necessary).
     sort($links);
     foreach ((array) $links as $link) {
         $class = $paged == $link ? ' class="active"  aria-label="' . __('Current page', 'artshow') . '"' : '';
         printf('<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url(get_pagenum_link($link)), $before_number . $link);
     }
     //  Link to last Page, plus ellipses, if necessary
     if (!in_array($max, $links)) {
         if (!in_array($max - 1, $links)) {
             echo '<li class="pagination-omission">&#x02026;</li>' . "\n";
         }
         $class = $paged == $max ? ' class="active"' : '';
         printf('<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url(get_pagenum_link($max)), $before_number . $max);
     }
     //  Next Post Link
     if (get_next_posts_link()) {
         printf('<li class="view_room">%s</li>' . "\n", get_next_posts_link(__('Next Room <strong class="rarr">&rarr;</strong>', 'artshow')));
     }
     echo '</ul></div>' . "\n";
 }
开发者ID:jtsternberg,项目名称:JTSternberg-Photos-Theme,代码行数:66,代码来源:functions.php

示例13: widget


//.........这里部分代码省略.........
                  *                                           descending order of posts.
                  *     @type bool   $exclude_displayed       True if posts shown in main output
                  *                                           should be excluded from this widget
                  *                                           output.
                  *     @type bool   $show_image              True if featured image should be
                  *                                           shown, false otherwise.
                  *     @type string $image_alignment         Image alignment: alignnone,
                  *                                           alignleft, aligncenter or alignright.
                  *     @type string $image_size              Name of the image size.
                  *     @type bool   $show_gravatar           True if author avatar should be
                  *                                           shown, false otherwise.
                  *     @type string $gravatar_alignment      Author avatar alignment: alignnone,
                  *                                           alignleft or aligncenter.
                  *     @type int    $gravatar_size           Dimension of the author avatar.
                  *     @type bool   $show_title              True if featured page title should
                  *                                           be shown, false otherwise.
                  *     @type bool   $show_byline             True if post info should be shown,
                  *                                           false otherwise.
                  *     @type string $post_info               Post info contents to show.
                  *     @type bool   $show_content            True if featured page content
                  *                                           should be shown, false otherwise.
                  *     @type int    $content_limit           Amount of content to show, in
                  *                                           characters.
                  *     @type int    $more_text               Text to use for More link.
                  *     @type int    $extra_num               Number of extra post titles to show.
                  *     @type string $extra_title             Heading for extra posts.
                  *     @type bool   $more_from_category      True if showing category archive
                  *                                           link, false otherwise.
                  *     @type string $more_from_category_text Category archive link text.
                  * }
                  * @param array  $args     {
                  *     Widget display arguments.
                  *
                  *     @type string $before_widget Markup or content to display before the widget.
                  *     @type string $before_title  Markup or content to display before the widget title.
                  *     @type string $after_title   Markup or content to display after the widget title.
                  *     @type string $after_widget  Markup or content to display after the widget.
                  * }
                  */
                 $title = apply_filters('genesis_featured_post_title', $title, $instance, $args);
                 $heading = genesis_a11y('headings') ? 'h4' : 'h2';
                 if (genesis_html5()) {
                     printf('<%s class="entry-title"><a href="%s">%s</a></%s>', $heading, get_permalink(), $title, $heading);
                 } else {
                     printf('<%s><a href="%s">%s</a></%s>', $heading, get_permalink(), $title, $heading);
                 }
             }
             if (!empty($instance['show_byline']) && !empty($instance['post_info'])) {
                 printf(genesis_html5() ? '<p class="entry-meta">%s</p>' : '<p class="byline post-info">%s</p>', do_shortcode($instance['post_info']));
             }
             if ($instance['show_title']) {
                 echo genesis_html5() ? '</header>' : '';
             }
             if (!empty($instance['show_content'])) {
                 echo genesis_html5() ? '<div class="entry-content">' : '';
                 if ('excerpt' == $instance['show_content']) {
                     the_excerpt();
                 } elseif ('content-limit' == $instance['show_content']) {
                     the_content_limit((int) $instance['content_limit'], genesis_a11y_more_link(esc_html($instance['more_text'])));
                 } else {
                     global $more;
                     $orig_more = $more;
                     $more = 0;
                     the_content(genesis_a11y_more_link(esc_html($instance['more_text'])));
                     $more = $orig_more;
                 }
                 echo genesis_html5() ? '</div>' : '';
             }
             genesis_markup(array('html5' => '</article>', 'xhtml' => '</div>'));
         }
     }
     //* Restore original query
     wp_reset_query();
     //* The EXTRA Posts (list)
     if (!empty($instance['extra_num'])) {
         if (!empty($instance['extra_title'])) {
             echo $args['before_title'] . esc_html($instance['extra_title']) . $args['after_title'];
         }
         $offset = intval($instance['posts_num']) + intval($instance['posts_offset']);
         $query_args = array('cat' => $instance['posts_cat'], 'showposts' => $instance['extra_num'], 'offset' => $offset);
         $wp_query = new WP_Query($query_args);
         $listitems = '';
         if (have_posts()) {
             while (have_posts()) {
                 the_post();
                 $_genesis_displayed_ids[] = get_the_ID();
                 $listitems .= sprintf('<li><a href="%s">%s</a></li>', get_permalink(), get_the_title());
             }
             if (mb_strlen($listitems) > 0) {
                 printf('<ul>%s</ul>', $listitems);
             }
         }
         //* Restore original query
         wp_reset_query();
     }
     if (!empty($instance['more_from_category']) && !empty($instance['posts_cat'])) {
         printf('<p class="more-from-category"><a href="%1$s" title="%2$s">%3$s</a></p>', esc_url(get_category_link($instance['posts_cat'])), esc_attr(get_cat_name($instance['posts_cat'])), esc_html($instance['more_from_category_text']));
     }
     echo $args['after_widget'];
 }
开发者ID:Friends-School-Atlanta,项目名称:Deployable-WordPress,代码行数:101,代码来源:featured-post-widget.php

示例14: genesis_superfish_enabled

/**
 * Determine if the Superfish script is enabled.
 *
 * If child theme supports HTML5 and the Load Superfish Script theme setting is checked, or if the
 * `genesis_superfish_enabled` filter is true, then this function returns true. False otherwise.
 *
 * @since 1.9.0
 *
 * @uses genesis_html5()      Check for HTML5 support.
 * @uses genesis_get_option() Get Theme settings value.
 *
 * @return boolean True if Superfish is enabled, false otherwise.
 */
function genesis_superfish_enabled()
{
    return !genesis_html5() && genesis_get_option('superfish') || genesis_a11y('drop-down-menu') || apply_filters('genesis_superfish_enabled', false);
}
开发者ID:Friends-School-Atlanta,项目名称:Deployable-WordPress,代码行数:17,代码来源:menu.php

示例15: genesis_numeric_posts_nav

/**
 * Echo archive pagination in page numbers format.
 *
 * Applies the `genesis_prev_link_text` and `genesis_next_link_text` filters.
 *
 * The links, if needed, are ordered as:
 *
 *  * previous page arrow,
 *  * first page,
 *  * up to two pages before current page,
 *  * current page,
 *  * up to two pages after the current page,
 *  * last page,
 *  * next page arrow.
 *
 * @since 0.2.3
 *
 * @global WP_Query $wp_query Query object.
 *
 * @return null Return early if on a single post or page, or only one page present.
 */
function genesis_numeric_posts_nav()
{
    if (is_singular()) {
        return;
    }
    global $wp_query;
    //* Stop execution if there's only 1 page
    if ($wp_query->max_num_pages <= 1) {
        return;
    }
    $paged = get_query_var('paged') ? absint(get_query_var('paged')) : 1;
    $max = intval($wp_query->max_num_pages);
    //* Add current page to the array
    if ($paged >= 1) {
        $links[] = $paged;
    }
    //* Add the pages around the current page to the array
    if ($paged >= 3) {
        $links[] = $paged - 1;
        $links[] = $paged - 2;
    }
    if ($paged + 2 <= $max) {
        $links[] = $paged + 2;
        $links[] = $paged + 1;
    }
    genesis_markup(array('html5' => '<div %s>', 'xhtml' => '<div class="navigation">', 'context' => 'archive-pagination'));
    $before_number = genesis_a11y('screen-reader-text') ? '<span class="screen-reader-text">' . __('Page ', 'genesis') . '</span>' : '';
    echo '<ul>';
    //* Previous Post Link
    if (get_previous_posts_link()) {
        printf('<li class="pagination-previous">%s</li>' . "\n", get_previous_posts_link(apply_filters('genesis_prev_link_text', '&#x000AB; ' . __('Previous Page', 'genesis'))));
    }
    //* Link to first page, plus ellipses if necessary
    if (!in_array(1, $links)) {
        $class = 1 == $paged ? ' class="active"' : '';
        printf('<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url(get_pagenum_link(1)), $before_number . '1');
        if (!in_array(2, $links)) {
            echo '<li class="pagination-omission">&#x02026;</li>' . "\n";
        }
    }
    //* Link to current page, plus 2 pages in either direction if necessary
    sort($links);
    foreach ((array) $links as $link) {
        $class = $paged == $link ? ' class="active"  aria-label="' . __('Current page', 'genesis') . '"' : '';
        printf('<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url(get_pagenum_link($link)), $before_number . $link);
    }
    //* Link to last page, plus ellipses if necessary
    if (!in_array($max, $links)) {
        if (!in_array($max - 1, $links)) {
            echo '<li class="pagination-omission">&#x02026;</li>' . "\n";
        }
        $class = $paged == $max ? ' class="active"' : '';
        printf('<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url(get_pagenum_link($max)), $before_number . $max);
    }
    //* Next Post Link
    if (get_next_posts_link()) {
        printf('<li class="pagination-next">%s</li>' . "\n", get_next_posts_link(apply_filters('genesis_next_link_text', __('Next Page', 'genesis') . ' &#x000BB;')));
    }
    echo '</ul></div>' . "\n";
}
开发者ID:nkeat12,项目名称:dv,代码行数:81,代码来源:post.php


注:本文中的genesis_a11y函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。