예제 #1
26
/**
 * 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>';
}
/**
 * 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;
}
예제 #3
0
/**
 * 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);
}
예제 #4
0
 /**
  * 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'];
 }
예제 #5
0
/**
 * 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>';
}
/**
 * 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));
}
/**
 * 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');
    }
}
 /**
  * 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'];
 }
예제 #9
0
/**
 * 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');
}
/**
 * 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>';
}
예제 #11
0
/**
 * 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');
 /**
  * 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";
 }
 /**
  * Echo the widget content.
  *
  * @since 0.1.8
  *
  * @global WP_Query $wp_query               Query object.
  * @global array    $_genesis_displayed_ids Array of displayed post IDs.
  * @global $integer $more
  *
  * @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)
 {
     global $wp_query, $_genesis_displayed_ids;
     //* Merge with defaults
     $instance = wp_parse_args((array) $instance, $this->defaults);
     echo $args['before_widget'];
     //* Set up the author bio
     if (!empty($instance['title'])) {
         echo $args['before_title'] . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $args['after_title'];
     }
     $query_args = array('post_type' => 'post', 'cat' => $instance['posts_cat'], 'showposts' => $instance['posts_num'], 'offset' => $instance['posts_offset'], 'orderby' => $instance['orderby'], 'order' => $instance['order'], 'ignore_sticky_posts' => $instance['exclude_sticky']);
     //* Exclude displayed IDs from this loop?
     if ($instance['exclude_displayed']) {
         $query_args['post__not_in'] = (array) $_genesis_displayed_ids;
     }
     $wp_query = new WP_Query($query_args);
     if (have_posts()) {
         while (have_posts()) {
             the_post();
             $_genesis_displayed_ids[] = get_the_ID();
             genesis_markup(array('html5' => '<article %s>', 'xhtml' => sprintf('<div class="%s">', implode(' ', get_post_class())), 'context' => 'entry'));
             $image = genesis_get_image(array('format' => 'html', 'size' => $instance['image_size'], 'context' => 'featured-post-widget', 'attr' => genesis_parse_attr('entry-image-widget', array('alt' => get_the_title()))));
             if ($instance['show_image'] && $image) {
                 $role = empty($instance['show_title']) ? '' : 'aria-hidden="true"';
                 printf('<a href="%s" class="%s" %s>%s</a>', get_permalink(), esc_attr($instance['image_alignment']), $role, $image);
             }
             if (!empty($instance['show_gravatar'])) {
                 echo '<span class="' . esc_attr($instance['gravatar_alignment']) . '">';
                 echo get_avatar(get_the_author_meta('ID'), $instance['gravatar_size']);
                 echo '</span>';
             }
             if ($instance['show_title']) {
                 echo genesis_html5() ? '<header class="entry-header">' : '';
             }
             if (!empty($instance['show_title'])) {
                 $title = get_the_title() ? get_the_title() : __('(no title)', 'genesis');
                 /**
                  * Filter the featured post widget title.
                  *
                  * @since  2.2.0
                  *
                  * @param string $title    Featured post title.
                  * @param array  $instance {
                  *     Widget settings for this instance.
                  *
                  *     @type string $title                   Widget title.
                  *     @type int    $posts_cat               ID of the post category.
                  *     @type int    $posts_num               Number of posts to show.
                  *     @type int    $posts_offset            Number of posts to skip when
                  *                                           retrieving.
                  *     @type string $orderby                 Field to order posts by.
                  *     @type string $order                   ASC fr ascending order, DESC for
                  *                                           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'];
 }
/**
 * 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);
}
예제 #15
0
파일: post.php 프로젝트: nkeat12/dv
/**
 * 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";
}
예제 #16
0
/**
 * Add skiplinks for screen readers and keyboard navigation
 *
 * @since  2.2.0
 */
function genesis_skip_links()
{
    if (!genesis_a11y('skip-links')) {
        return;
    }
    // Call function to add IDs to the markup
    genesis_skiplinks_markup();
    // Determine which skip links are needed
    $links = array();
    if (genesis_nav_menu_supported('primary') && has_nav_menu('primary')) {
        $links['genesis-nav-primary'] = __('Skip to primary navigation', 'genesis');
    }
    $links['genesis-content'] = __('Skip to content', 'genesis');
    if ('full-width-content' != genesis_site_layout()) {
        $links['genesis-sidebar-primary'] = __('Skip to primary sidebar', 'genesis');
    }
    if (in_array(genesis_site_layout(), array('sidebar-sidebar-content', 'sidebar-content-sidebar', 'content-sidebar-sidebar'))) {
        $links['genesis-sidebar-secondary'] = __('Skip to secondary sidebar', 'genesis');
    }
    if (current_theme_supports('genesis-footer-widgets')) {
        $footer_widgets = get_theme_support('genesis-footer-widgets');
        if (isset($footer_widgets[0]) && is_numeric($footer_widgets[0])) {
            if (is_active_sidebar('footer-1')) {
                $links['genesis-footer-widgets'] = __('Skip to footer', 'genesis');
            }
        }
    }
    /**
     * Filter the skip links.
     *
     * @since 2.2.0
     *
     * @param array $links {
     *     Default skiplinks.
     *
     *     @type string HTML ID attribute value to link to.
     *     @type string Anchor text.
     * }
     */
    $links = apply_filters('genesis_skip_links_output', $links);
    // write HTML, skiplinks in a list with a heading
    $skiplinks = '<section>';
    $skiplinks .= '<h2 class="screen-reader-text">' . __('Skip links', 'genesis') . '</h2>';
    $skiplinks .= '<ul class="genesis-skip-link">';
    // Add markup for each skiplink
    foreach ($links as $key => $value) {
        $skiplinks .= '<li><a href="' . esc_url('#' . $key) . '" class="screen-reader-shortcut"> ' . $value . '</a></li>';
    }
    $skiplinks .= '</ul>';
    $skiplinks .= '</section>' . "\n";
    echo $skiplinks;
}
 /**
  * Echo the widget content.
  *
  * @since 0.1.8
  *
  * @global WP_Query $wp_query Query object.
  * @global integer  $more
  *
  * @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)
 {
     global $wp_query;
     //* Merge with defaults
     $instance = wp_parse_args((array) $instance, $this->defaults);
     echo $args['before_widget'];
     //* Set up the author bio
     if (!empty($instance['title'])) {
         echo $args['before_title'] . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $args['after_title'];
     }
     $wp_query = new WP_Query(array('page_id' => $instance['page_id']));
     if (have_posts()) {
         while (have_posts()) {
             the_post();
             genesis_markup(array('html5' => '<article %s>', 'xhtml' => sprintf('<div class="%s">', implode(' ', get_post_class())), 'context' => 'entry'));
             $image = genesis_get_image(array('format' => 'html', 'size' => $instance['image_size'], 'context' => 'featured-page-widget', 'attr' => genesis_parse_attr('entry-image-widget', array('alt' => get_the_title()))));
             if ($instance['show_image'] && $image) {
                 $role = empty($instance['show_title']) ? '' : 'aria-hidden="true"';
                 printf('<a href="%s" class="%s" %s>%s</a>', get_permalink(), esc_attr($instance['image_alignment']), $role, $image);
             }
             if (!empty($instance['show_title'])) {
                 $title = get_the_title() ? get_the_title() : __('(no title)', 'genesis');
                 /**
                  * Filter the featured page widget title.
                  *
                  * @since  2.2.0
                  *
                  * @param string $title    Featured page title.
                  * @param array  $instance {
                  *     Widget settings for this instance.
                  *
                  *     @type string $title           Widget title.
                  *     @type int    $page_id         ID of the featured page.
                  *     @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_title      True if featured page title should be shown,
                  *                                   false otherwise.
                  *     @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.
                  * }
                  * @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_page_title', $title, $instance, $args);
                 $heading = genesis_a11y('headings') ? 'h4' : 'h2';
                 if (genesis_html5()) {
                     printf('<header class="entry-header"><%s class="entry-title"><a href="%s">%s</a></%s></header>', $heading, get_permalink(), $title, $heading);
                 } else {
                     printf('<%s><a href="%s">%s</a></%s>', $heading, get_permalink(), $title, $heading);
                 }
             }
             if (!empty($instance['show_content'])) {
                 echo genesis_html5() ? '<div class="entry-content">' : '';
                 if (empty($instance['content_limit'])) {
                     global $more;
                     $orig_more = $more;
                     $more = 0;
                     the_content(genesis_a11y_more_link($instance['more_text']));
                     $more = $orig_more;
                 } else {
                     the_content_limit((int) $instance['content_limit'], genesis_a11y_more_link(esc_html($instance['more_text'])));
                 }
                 echo genesis_html5() ? '</div>' : '';
             }
             genesis_markup(array('html5' => '</article>', 'xhtml' => '</div>'));
         }
     }
     //* Restore original query
     wp_reset_query();
     echo $args['after_widget'];
 }
function bsg_genesis_numeric_posts_nav()
{
    if (is_singular()) {
        return;
    }
    global $wp_query;
    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);
    if ($paged >= 1) {
        $links[] = $paged;
    }
    if ($paged >= 3) {
        $links[] = $paged - 1;
        $links[] = $paged - 2;
    }
    if ($paged + 2 <= $max) {
        $links[] = $paged + 2;
        $links[] = $paged + 1;
    }
    echo '<div class="clearfix"></div>';
    printf('<div %s>', genesis_attr('archive-pagination'));
    $before_number = genesis_a11y('screen-reader-text') ? '<span class="sr-only">' . __('Page ', 'genesis') . '</span>' : '';
    printf('<ul %s>', genesis_attr('pagination'));
    // pagination-lg pagination-sm
    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'))));
    }
    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');
    }
    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);
    }
    if (!in_array($max, $links)) {
        $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);
    }
    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";
}
예제 #19
0
/**
 * Adds an H2 title to widget areas.
 *
 * For using a semantic heading structure, improves accessibility
 *
 * @since 2.2.0
 *
 * @global array $wp_registered_sidebars
 *
 * @param string $id Sidebar ID, as per when it was registered.
 * @return string Widget area heading, or `null` if `headings` are not enabled for
 *                Genesis accessibility, or `$id` is not registered as a widget area ID.
 */
function genesis_sidebar_title($id)
{
    if (genesis_a11y('headings') && $id) {
        global $wp_registered_sidebars;
        if (array_key_exists($id, $wp_registered_sidebars)) {
            $name = $wp_registered_sidebars[$id]['name'];
        } else {
            $name = $id;
        }
        $heading = '<h2 class="genesis-sidebar-title screen-reader-text">' . $name . '</h2>';
        return apply_filters('genesis_sidebar_title_output', $heading, $id);
    }
}
예제 #20
0
파일: archive.php 프로젝트: hoaint/junhee
/**
 * Add custom headline and description to blog template pages.
 *
 * If we're not on a blog template page, then nothing extra is displayed.
 *
 * @since 2.2.0
 *
 * @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 blog template archive.
 */
function genesis_do_blog_template_heading()
{
    if (!is_page_template('page_blog.php') || !genesis_a11y('headings')) {
        return;
    }
    echo '<div class="archive-description page-blog">';
    genesis_do_post_title();
    echo '</div>';
}
예제 #21
0
/**
 * This function outputs sitemap-esque columns displaying all pages,
 * categories, authors, monthly archives, and recent posts.
 *
 * @since 1.6
 *
 * @uses genesis_a11y() to check for headings choice.
 * @uses genesis_sitemap() to generate the sitemap.
 *
 */
function genesis_page_archive_content()
{
    $heading = genesis_a11y('headings') ? 'h2' : 'h4';
    genesis_sitemap($heading);
}
예제 #22
0
파일: xhtml.php 프로젝트: netmagik/netmagik
/**
 * Replace `close` html5 markup with xhtml equivalent.
 *
 * @since 2.4.0
 *
 * @param string $close Close markup.
 *
 * @param array $args Markup arguments.
 *
 * @return string Xhtml close markup.
 */
function genesis_markup_close_xhtml($close, $args)
{
    if (empty($args['context'])) {
        return $close;
    }
    if (substr($args['context'], 0, 4) == 'nav-') {
        return '</div>';
    }
    if ('entry-content' == $args['context'] && !is_main_query() && !genesis_is_blog_template()) {
        return '';
    }
    switch ($args['context']) {
        case 'entry':
        case 'content-sidebar-wrap':
        case 'content':
        case 'entry-404':
        case 'entry-meta-after-content':
        case 'entry-meta-before-content':
        case 'sidebar-primary':
        case 'sidebar-secondary':
        case 'site-footer':
        case 'site-header':
            $close = '</div>';
            break;
        case 'entry-header':
        case 'header-nav':
        case 'semantic-description':
        case 'semantic-headings':
        case 'widget-entry-content':
            $close = '';
            break;
        case 'entry-pagination':
            $close = '</p>';
            break;
        case 'entry-title':
        case 'site-description':
        case 'site-title':
            $wrap = isset($args['params']) && !empty($args['params']['wrap']) ? $args['params']['wrap'] : '';
            $close = "</{$wrap}>";
            break;
        case 'widget-entry-title':
            $close = genesis_a11y('headings') ? '</h4>' : '</h2>';
            break;
        case 'widget-wrap':
            $close = '</div></div>' . "\n";
            break;
    }
    return $close;
}