function genesis_nav($args = array())
{
    $defaults = array('context' => '', 'type' => 'pages', 'sort_column' => 'menu_order, post_title', 'menu_id' => false, 'menu_class' => 'nav', 'echo' => true, 'link_before' => '', 'link_after' => '');
    $defaults = apply_filters('genesis_nav_default_args', $defaults);
    $args = wp_parse_args($args, $defaults);
    $menu = '';
    $list_args = $args;
    // Show Home in the menu (mostly copied from WP source)
    if (isset($args['show_home']) && !empty($args['show_home'])) {
        if (true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home']) {
            $text = apply_filters('genesis_nav_home_text', __('Home', 'genesis'), $args);
        } else {
            $text = $args['show_home'];
        }
        $class = '';
        if (is_front_page() && !is_paged()) {
            $class = 'class="home current_page_item"';
        } else {
            $class = 'class="home"';
        }
        $home = '<li ' . $class . '><a href="' . get_bloginfo('siteurl') . '" title="' . esc_attr($text) . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>';
        $menu .= genesis_get_seo_option('nofollow_home_link') ? genesis_rel_nofollow($home) : $home;
        // If the front page is a page, add it to the exclude list
        if (get_option('show_on_front') == 'page' && $args['type'] == 'pages') {
            if (!empty($list_args['exclude'])) {
                $list_args['exclude'] .= ',';
            } else {
                $list_args['exclude'] = '';
            }
            $list_args['exclude'] .= get_option('page_on_front');
        }
    }
    $list_args['echo'] = false;
    $list_args['title_li'] = '';
    if ($args['type'] == 'pages') {
        $menu .= str_replace(array("\r", "\n", "\t"), '', wp_list_pages($list_args));
    } elseif ($args['type'] == 'categories') {
        $menu .= str_replace(array("\r", "\n", "\t"), '', wp_list_categories($list_args));
    }
    // Apply filters to the nav items
    $menu = apply_filters('genesis_nav_items', $menu, $args);
    $menu_class = $args['menu_class'] ? ' class="' . esc_attr($args['menu_class']) . '"' : '';
    $menu_id = $args['menu_id'] ? ' id="' . esc_attr($args['menu_id']) . '"' : '';
    if ($menu) {
        $menu = '<ul' . $menu_id . $menu_class . '>' . $menu . '</ul>';
    }
    // Apply filters to the final nav output
    $menu = apply_filters('genesis_nav', $menu, $args);
    if ($args['echo']) {
        echo $menu;
    } else {
        return $menu;
    }
}
Beispiel #2
0
function custom_header_inline_logo($title, $inside, $wrap)
{
    $logo = '<img src="' . get_stylesheet_directory_uri() . '/images/logo.png" alt="' . esc_attr(get_bloginfo('name')) . '" title="' . esc_attr(get_bloginfo('name')) . '" width="359" height="72" />';
    $inside = sprintf('<a href="%s" title="%s">%s</a>', trailingslashit(home_url()), esc_attr(get_bloginfo('name')), $logo);
    // Determine which wrapping tags to use - changed is_home to is_front_page to fix Genesis bug
    $wrap = is_front_page() && 'title' === genesis_get_seo_option('home_h1_on') ? 'h1' : 'p';
    // A little fallback, in case an SEO plugin is active - changed is_home to is_front_page to fix Genesis bug
    $wrap = is_front_page() && !genesis_get_seo_option('home_h1_on') ? 'h1' : $wrap;
    // And finally, $wrap in h1 if HTML5 & semantic headings enabled
    $wrap = genesis_html5() && genesis_get_seo_option('semantic_headings') ? 'h1' : $wrap;
    return sprintf('<%1$s %2$s>%3$s</%1$s>', $wrap, genesis_attr('site-title'), $inside);
}
/**
 * Echo the site title into the header.
 *
 * Depending on the SEO option set by the user, this will either be wrapped in an `h1` or `p` element.
 *
 * Applies the `genesis_seo_title` filter before echoing.
 *
 * @since 1.1.0
 *
 * @uses genesis_get_seo_option() Get SEO setting value.
 * @uses genesis_html5()          Check or HTML5 support.
 */
function ygf_seo_site_title()
{
    // Set what goes inside the wrapping tags
    $inside = sprintf('<a href="%s" class="menu-text">%s</a>', trailingslashit(home_url()), get_bloginfo('name'));
    // Determine which wrapping tags to use
    $wrap = is_home() && 'title' === genesis_get_seo_option('home_h1_on') ? 'h1' : 'h1';
    // A little fallback, in case an SEO plugin is active
    $wrap = is_home() && !genesis_get_seo_option('home_h1_on') ? 'h1' : $wrap;
    // And finally, $wrap in h1 if HTML5 & semantic headings enabled
    $wrap = genesis_html5() && genesis_get_seo_option('semantic_headings') ? 'h1' : $wrap;
    // Build the title
    $title = genesis_html5() ? sprintf("<li class='name'><{$wrap} %s>", genesis_attr('site-title')) : sprintf('<%s id="title">%s</%s>', $wrap, $inside, $wrap);
    $title .= genesis_html5() ? "{$inside}</{$wrap}></li>" : '';
    if (!has_nav_menu('mobile-off-canvas')) {
        $title .= '<li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li>';
    }
    // Echo (filtered)
    echo apply_filters('genesis_seo_title', $title, $inside, $wrap);
}
Beispiel #4
0
/**
 * Update Genesis to the latest version.
 *
 * This iterative update function will take a Genesis installation, no matter
 * how old, and update its options to the latest version.
 *
 * It used to iterate over theme version, but now uses a database version
 * system, which allows for changes within pre-releases, too.
 *
 * @since 1.0.1
 *
 * @return null Return early if we're already on the latest version.
 */
function genesis_upgrade()
{
    // Don't do anything if we're on the latest version.
    if (genesis_get_option('db_version', null, false) >= PARENT_DB_VERSION) {
        return;
    }
    global $wp_db_version;
    // If the WP db hasn't been upgraded, make them upgrade first.
    if (get_option('db_version') != $wp_db_version) {
        wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(wp_unslash($_SERVER['REQUEST_URI']))));
        exit;
    }
    // UPDATE TO VERSION 1.0.1.
    if (version_compare(genesis_get_option('theme_version', null, false), '1.0.1', '<')) {
        $theme_settings = get_option(GENESIS_SETTINGS_FIELD);
        $new_settings = array('nav_home' => 1, 'nav_twitter_text' => 'Follow me on Twitter', 'subnav_home' => 1, 'theme_version' => '1.0.1');
        $settings = wp_parse_args($new_settings, $theme_settings);
        update_option(GENESIS_SETTINGS_FIELD, $settings);
    }
    // UPDATE TO VERSION 1.1.
    if (version_compare(genesis_get_option('theme_version', null, false), '1.1', '<')) {
        $theme_settings = get_option(GENESIS_SETTINGS_FIELD);
        $new_settings = array('content_archive_thumbnail' => genesis_get_option('thumbnail'), 'theme_version' => '1.1');
        $settings = wp_parse_args($new_settings, $theme_settings);
        update_option(GENESIS_SETTINGS_FIELD, $settings);
    }
    // UPDATE TO VERSION 1.1.2.
    if (version_compare(genesis_get_option('theme_version', null, false), '1.1.2', '<')) {
        $theme_settings = get_option(GENESIS_SETTINGS_FIELD);
        $new_settings = array('header_right' => genesis_get_option('header_full') ? 0 : 1, 'nav_superfish' => 1, 'subnav_superfish' => 1, 'nav_extras_enable' => genesis_get_option('nav_right') ? 1 : 0, 'nav_extras' => genesis_get_option('nav_right'), 'nav_extras_twitter_id' => genesis_get_option('twitter_id'), 'nav_extras_twitter_text' => genesis_get_option('nav_twitter_text'), 'theme_version' => '1.1.2');
        $settings = wp_parse_args($new_settings, $theme_settings);
        update_option(GENESIS_SETTINGS_FIELD, $settings);
    }
    // UPDATE TO VERSION 1.2.
    if (version_compare(genesis_get_option('theme_version', null, false), '1.2', '<')) {
        $theme_settings = get_option(GENESIS_SETTINGS_FIELD);
        $new_settings = array('update' => 1, 'theme_version' => '1.2');
        $settings = wp_parse_args($new_settings, $theme_settings);
        update_option(GENESIS_SETTINGS_FIELD, $settings);
    }
    // UPDATE TO VERSION 1.3.
    if (version_compare(genesis_get_option('theme_version', null, false), '1.3', '<')) {
        // Update theme settings.
        $theme_settings = get_option(GENESIS_SETTINGS_FIELD);
        $new_settings = array('author_box_single' => genesis_get_option('author_box'), 'theme_version' => '1.3');
        $settings = wp_parse_args($new_settings, $theme_settings);
        update_option(GENESIS_SETTINGS_FIELD, $settings);
        // Update SEO settings.
        $seo_settings = get_option(GENESIS_SEO_SETTINGS_FIELD);
        $new_settings = array('noindex_cat_archive' => genesis_get_seo_option('index_cat_archive') ? 0 : 1, 'noindex_tag_archive' => genesis_get_seo_option('index_tag_archive') ? 0 : 1, 'noindex_author_archive' => genesis_get_seo_option('index_author_archive') ? 0 : 1, 'noindex_date_archive' => genesis_get_seo_option('index_date_archive') ? 0 : 1, 'noindex_search_archive' => genesis_get_seo_option('index_search_archive') ? 0 : 1, 'noodp' => 1, 'noydir' => 1, 'canonical_archives' => 1);
        $settings = wp_parse_args($new_settings, $seo_settings);
        update_option(GENESIS_SEO_SETTINGS_FIELD, $settings);
        // Delete the store transient, force refresh.
        delete_transient('genesis-remote-store');
    }
    // UPDATE TO VERSION 1.6.
    if (version_compare(genesis_get_option('theme_version', null, false), '1.6', '<')) {
        // Vestige nav settings, for backward compatibility.
        if ('nav-menu' !== genesis_get_option('nav_type')) {
            _genesis_vestige(array('nav_type', 'nav_superfish', 'nav_home', 'nav_pages_sort', 'nav_categories_sort', 'nav_depth', 'nav_exclude', 'nav_include'));
        }
        // Vestige subnav settings, for backward compatibility.
        if ('nav-menu' !== genesis_get_option('subnav_type')) {
            _genesis_vestige(array('subnav_type', 'subnav_superfish', 'subnav_home', 'subnav_pages_sort', 'subnav_categories_sort', 'subnav_depth', 'subnav_exclude', 'subnav_include'));
        }
        $theme_settings = get_option(GENESIS_SETTINGS_FIELD);
        $new_settings = array('theme_version' => '1.6');
        $settings = wp_parse_args($new_settings, $theme_settings);
        update_option(GENESIS_SETTINGS_FIELD, $settings);
    }
    // UPDATE DB TO VERSION 1700.
    if (genesis_get_option('db_version', null, false) < '1700') {
        genesis_upgrade_1700();
    }
    // UPDATE DB TO VERSION 1800.
    if (genesis_get_option('db_version', null, false) < '1800') {
        genesis_upgrade_1800();
    }
    // UPDATE DB TO VERSION 1901.
    if (genesis_get_option('db_version', null, false) < '1901') {
        genesis_upgrade_1901();
    }
    // UPDATE DB TO VERSION 2001.
    if (genesis_get_option('db_version', null, false) < '2001') {
        genesis_upgrade_2001();
    }
    // UPDATE DB TO VERSION 2003.
    if (genesis_get_option('db_version', null, false) < '2003') {
        genesis_upgrade_2003();
    }
    // UPDATE DB TO VERSION 2100.
    if (genesis_get_option('db_version', null, false) < '2100') {
        genesis_upgrade_2100();
    }
    // UPDATE DB TO VERSION 2201.
    if (genesis_get_option('db_version', null, false) < '2201') {
        genesis_upgrade_2201();
    }
    // UPDATE DB TO VERSION 2207.
    if (genesis_get_option('db_version', null, false) < '2207') {
        genesis_upgrade_2207();
    }
    // UPDATE DB TO VERSION 2209.
    if (genesis_get_option('db_version', null, false) < '2209') {
        genesis_upgrade_2209();
    }
    // UPDATE DB TO VERSION 2403.
    if (genesis_get_option('db_version', null, false) < '2403') {
        genesis_upgrade_2403();
    }
    do_action('genesis_upgrade');
}
Beispiel #5
0
/**
 * Echo custom rel="author" link tag.
 *
 * If the appropriate information has been entered, either for the homepage author,
 * or for an individual post/page author, echo a custom rel="author" link.
 *
 * @since 1.9.0
 *
 * @uses genesis_get_seo_option()
 *
 * @global $post
 * @return null Returns null on failure
 */
function genesis_rel_author()
{
    if (is_front_page() && ($gplus_url = get_user_option('googleplus', genesis_get_seo_option('home_author')))) {
        printf('<link rel="author" href="%s" />' . "\n", esc_url($gplus_url));
        return;
    }
    global $post;
    if (is_singular() && isset($post->post_author) && ($gplus_url = get_user_option('googleplus', $post->post_author))) {
        printf('<link rel="author" href="%s" />' . "\n", esc_url($gplus_url));
        return;
    }
    if (is_author() && get_query_var('author') && ($gplus_url = get_user_option('googleplus', get_query_var('author')))) {
        printf('<link rel="author" href="%s" />' . "\n", esc_url($gplus_url));
        return;
    }
}
function genesis_seo_settings_archives_box()
{
    ?>

	<p><label><input type="checkbox" name="<?php 
    echo GENESIS_SEO_SETTINGS_FIELD;
    ?>
[canonical_archives]" value="1" <?php 
    checked(1, genesis_get_seo_option('canonical_archives'));
    ?>
 /> <?php 
    printf(__('Canonical Paginated Archives', 'genesis'));
    ?>
 </label></p>

	<p><span class="description"><?php 
    _e('This option points search engines to the first page of an archive, if viewing a paginated page. If you do not know what this means, leave it on.', 'genesis');
    ?>
</span></p>

<?php 
}
function genesis_canonical()
{
    global $wp_query;
    $canonical = '';
    if (is_front_page()) {
        $canonical = get_bloginfo('url');
    }
    if (is_singular()) {
        if (!($id = $wp_query->get_queried_object_id())) {
            return;
        }
        $cf = genesis_get_custom_field('_genesis_canonical_uri');
        $canonical = $cf ? $cf : get_permalink($id);
    }
    if (is_category() || is_tag() || is_tax()) {
        if (!($id = $wp_query->get_queried_object_id())) {
            return;
        }
        $taxonomy = $wp_query->queried_object->taxonomy;
        $canonical = genesis_get_seo_option('canonical_archives') ? get_term_link($id, $taxonomy) : 0;
    }
    if (is_author()) {
        if (!($id = $wp_query->get_queried_object_id())) {
            return;
        }
        $canonical = genesis_get_seo_option('canonical_archives') ? get_author_posts_url($id) : 0;
    }
    if (!$canonical) {
        return;
    }
    printf('<link rel="canonical" href="%s" />' . "\n", esc_url($canonical));
}
Beispiel #8
0
function custom_header_inline_logo($title, $inside, $wrap)
{
    $logo = '<img src="' . get_stylesheet_directory_uri() . '/images/logo.png" alt="' . esc_attr(get_bloginfo('name')) . ' Homepage" width="200" height="100" />';
    $inside = sprintf('<a href="%s">%s<span class="screen-reader-text">%s</span></a>', trailingslashit(home_url()), $logo, get_bloginfo('name'));
    //echo genesis_get_seo_option( 'home_h1_on' );
    // Determine which wrapping tags to use
    //$wrap = genesis_is_root_page() && 'title' === genesis_get_seo_option( 'home_h1_on' ) ? 'h1' : 'p';
    $wrap = 'h1';
    //return;
    // A little fallback, in case an SEO plugin is active
    //$wrap = genesis_is_root_page() && ! genesis_get_seo_option( 'home_h1_on' ) ? 'h1' : $wrap;
    // And finally, $wrap in h1 if HTML5 & semantic headings enabled
    $wrap = genesis_html5() && genesis_get_seo_option('semantic_headings') ? 'h1' : $wrap;
    return sprintf('<%1$s %2$s>%3$s</%1$s>', $wrap, genesis_attr('site-title'), $inside);
}
Beispiel #9
0
/**
 * Echo the the author box and its contents.
 *
 * The title is filterable via `genesis_author_box_title`, and the gravatar size is filterable via
 * `genesis_author_box_gravatar_size`.
 *
 * The final output is filterable via `genesis_author_box`, which passes many variables through.
 *
 * @since 1.3.0
 *
 * @uses genesis_html5() Check for HTML5 support.
 * @uses genesis_attr()  Contextual attributes.
 *
 * @global WP_User $authordata Author (user) object.
 *
 * @param string $context Optional. Allows different author box markup for different contexts, specifically 'single'.
 *                        Default is empty string.
 * @param bool   $echo    Optional. If true, the author box will echo. If false, it will be returned.
 *
 * @return string HTML for author box.
 */
function genesis_author_box($context = '', $echo = true)
{
    global $authordata;
    $authordata = is_object($authordata) ? $authordata : get_userdata(get_query_var('author'));
    $gravatar_size = apply_filters('genesis_author_box_gravatar_size', 70, $context);
    $gravatar = get_avatar(get_the_author_meta('email'), $gravatar_size);
    $description = wpautop(get_the_author_meta('description'));
    //* The author box markup, contextual
    if (genesis_html5()) {
        $title = __('About', 'genesis') . ' <span itemprop="name">' . get_the_author() . '</span>';
        /**
         * Author box title filter.
         *
         * Allows you to filter the title of the author box. $context passed as second parameter to allow for contextual filtering.
         *
         * @since unknown
         *
         * @param string $title Assembled Title.
         * @param string $context Context.
         */
        $title = apply_filters('genesis_author_box_title', $title, $context);
        if ('single' === $context && !genesis_get_seo_option('semantic_headings')) {
            $heading_element = 'h4';
        } elseif (genesis_a11y('headings') || get_the_author_meta('headline', (int) get_query_var('author'))) {
            $heading_element = 'h4';
        } else {
            $heading_element = 'h1';
        }
        $pattern = sprintf('<section %s>', genesis_attr('author-box'));
        $pattern .= '%s<' . $heading_element . ' class="author-box-title">%s</' . $heading_element . '>';
        $pattern .= '<div class="author-box-content" itemprop="description">%s</div>';
        $pattern .= '</section>';
    } else {
        $title = apply_filters('genesis_author_box_title', sprintf('<strong>%s %s</strong>', __('About', 'genesis'), get_the_author()), $context);
        if ('single' === $context || get_the_author_meta('headline', (int) get_query_var('author'))) {
            $pattern = '<div class="author-box"><div>%s %s<br />%s</div></div>';
        } else {
            $pattern = '<div class="author-box">%s<h1>%s</h1><div>%s</div></div>';
        }
    }
    $output = sprintf($pattern, $gravatar, $title, $description);
    /**
     * Author box output filter.
     *
     * Allows you to filter the full output of the author box.
     *
     * @since unknown
     *
     * @param string $output Assembled output.
     * @param string $context Context.
     * @param string $pattern (s)printf pattern.
     * @param string $context Gravatar.
     * @param string $context Title.
     * @param string $context Description.
     */
    $output = apply_filters('genesis_author_box', $output, $context, $pattern, $gravatar, $title, $description);
    if ($echo) {
        echo $output;
    } else {
        return $output;
    }
}
/**
 * Echo the site title into the header.
 *
 * Depending on the SEO option set by the user, this will either be wrapped in an `h1` or `p` element.
 *
 * Applies the `genesis_seo_title` filter before echoing.
 *
 * @since 1.1.0
 *
 * @uses genesis_get_seo_option() Get SEO setting value.
 * @uses genesis_html5()          Check or HTML5 support.
 */
function gmdl_seo_site_title()
{
    // Set what goes inside the wrapping tags
    $inside = sprintf('<a href="%s">%s</a>', trailingslashit(home_url()), get_bloginfo('name'));
    // Determine which wrapping tags to use
    $wrap = is_home() && 'title' === genesis_get_seo_option('home_h1_on') ? 'h1' : 'h1';
    // A little fallback, in case an SEO plugin is active
    $wrap = is_home() && !genesis_get_seo_option('home_h1_on') ? 'h1' : $wrap;
    // And finally, $wrap in h1 if HTML5 & semantic headings enabled
    $wrap = genesis_html5() && genesis_get_seo_option('semantic_headings') ? 'h1' : $wrap;
    // Build the title
    $title = genesis_html5() ? sprintf("<div class='name'><{$wrap} %s>", genesis_attr('site-title')) : sprintf('<%s id="title">%s</%s>', $wrap, $inside, $wrap);
    $title .= genesis_html5() ? "{$inside}</{$wrap}>" : '';
    // Echo (filtered)
    echo apply_filters('genesis_seo_title', $title, $inside, $wrap);
}
Beispiel #11
0
/**
 * Echoes or returns a pages or categories menu.
 *
 * Now only used for backwards-compatibility (genesis_vestige).
 *
 * The array of menu arguments (and their defaults) are:
 * - theme_location => ''
 * - type           => 'pages'
 * - sort_column    => 'menu_order, post_title'
 * - menu_id        => false
 * - menu_class     => 'nav'
 * - echo           => true
 * - link_before    => ''
 * - link_after     => ''
 *
 * Themes can short-circuit the function early by filtering on 'genesis_pre_nav' or
 * on the string of list items via 'genesis_nav_items. They can also filter the
 * complete menu markup via 'genesis_nav'. The $args (merged with defaults) are
 * available for all filters.
 *
 * @category Genesis
 * @package Structure
 * @subpackage Menus
 *
 * @since 0.2.3
 *
 * @uses genesis_get_seo_option()
 * @uses genesis_rel_nofollow()
 *
 * @see genesis_do_nav()
 * @see genesis_do_subnav()
 *
 * @param array $args Menu arguments
 * @return string HTML for menu (unless genesis_pre_nav returns something truthy)
 */
function genesis_nav($args = array())
{
    if (isset($args['context'])) {
        _deprecated_argument(__FUNCTION__, '1.2', __('The argument, "context", has been replaced with "theme_location" in the $args array.', 'genesis'));
    }
    /** Default arguments */
    $defaults = array('theme_location' => '', 'type' => 'pages', 'sort_column' => 'menu_order, post_title', 'menu_id' => false, 'menu_class' => 'nav', 'echo' => true, 'link_before' => '', 'link_after' => '');
    $defaults = apply_filters('genesis_nav_default_args', $defaults);
    $args = wp_parse_args($args, $defaults);
    /** Allow child theme to short-circuit this function */
    $pre = apply_filters('genesis_pre_nav', false, $args);
    if ($pre) {
        return $pre;
    }
    $menu = '';
    $list_args = $args;
    /** Show Home in the menu (mostly copied from WP source) */
    if (isset($args['show_home']) && !empty($args['show_home'])) {
        if (true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home']) {
            $text = apply_filters('genesis_nav_home_text', __('Home', 'genesis'), $args);
        } else {
            $text = $args['show_home'];
        }
        $class = '';
        if (is_front_page() && !is_paged()) {
            $class = 'class="home current_page_item"';
        } else {
            $class = 'class="home"';
        }
        $home = '<li ' . $class . '><a href="' . trailingslashit(home_url()) . '" title="' . esc_attr($text) . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>';
        $menu .= genesis_get_seo_option('nofollow_home_link') ? genesis_rel_nofollow($home) : $home;
        /** If the front page is a page, add it to the exclude list */
        if ('page' == get_option('show_on_front') && 'pages' == $args['type']) {
            $list_args['exclude'] .= $list_args['exclude'] ? ',' : '';
            $list_args['exclude'] .= get_option('page_on_front');
        }
    }
    $list_args['echo'] = false;
    $list_args['title_li'] = '';
    /** Add menu items */
    if ('pages' == $args['type']) {
        $menu .= str_replace(array("\r", "\n", "\t"), '', wp_list_pages($list_args));
    } elseif ('categories' == $args['type']) {
        $menu .= str_replace(array("\r", "\n", "\t"), '', wp_list_categories($list_args));
    }
    /** Apply filters to the nav items */
    $menu = apply_filters('genesis_nav_items', $menu, $args);
    $menu_class = $args['menu_class'] ? ' class="' . esc_attr($args['menu_class']) . '"' : '';
    $menu_id = $args['menu_id'] ? ' id="' . esc_attr($args['menu_id']) . '"' : '';
    if ($menu) {
        $menu = '<ul' . $menu_id . $menu_class . '>' . $menu . '</ul>';
    }
    /** Apply filters to the final nav output */
    $menu = apply_filters('genesis_nav', $menu, $args);
    if ($args['echo']) {
        echo $menu;
    } else {
        return $menu;
    }
}
Beispiel #12
0
/**
 * Changes Site Description to H1 (Genesis does an H2 by default). Bozo?
 * @param type $title 
 * @param type $inside 
 * @param type $wrap 
 * @return type
 * @since 1.0
 */
function cuttz_desc($description, $inside, $wrap)
{
    $tag = is_home() && 'description' === genesis_get_seo_option('home_h1_on') ? 'h1' : 'p';
    $tag = genesis_html5() && genesis_get_seo_option('semantic_headings') ? 'h1' : $tag;
    $description = preg_replace("/<{$wrap}\\s(.+?)>(.+?)<\\/{$wrap}>/is", "<{$tag} \$1>\$2</{$tag}>", $description);
    return $description;
}
function bw_header_inline_logo($title, $inside, $wrap)
{
    // remove site tagline
    remove_action('genesis_site_description', 'genesis_seo_site_description');
    if (get_theme_mod('s_logo')) {
        $logo = '<img id="logo" src="' . get_theme_mod('s_logo') . '" alt="' . esc_attr(get_bloginfo('name')) . '" title="' . esc_attr(get_bloginfo('name')) . '">';
    } else {
        $logo = '<img id ="logo" src="' . get_stylesheet_directory_uri() . '/images/logo.png" alt="' . esc_attr(get_bloginfo('name')) . '" title="' . esc_attr(get_bloginfo('name')) . '">';
    }
    $inside = sprintf('<a href="%s" title="%s">%s</a>', trailingslashit(home_url()), esc_attr(get_bloginfo('name')), $logo);
    //* Determine which wrapping tags to use - changed is_home to is_front_page to fix Genesis bug
    $wrap = is_front_page() && 'title' === genesis_get_seo_option('home_h1_on') ? 'h1' : 'p';
    //* A little fallback, in case an SEO plugin is active - changed is_home to is_front_page to fix Genesis bug
    $wrap = is_front_page() && !genesis_get_seo_option('home_h1_on') ? 'h1' : $wrap;
    //* And finally, $wrap in h1 if HTML5 & semantic headings enabled
    $wrap = genesis_html5() && genesis_get_seo_option('semantic_headings') ? 'h1' : $wrap;
    return sprintf('<%1$s %2$s>%3$s</%1$s>', $wrap, genesis_attr('site-title'), $inside);
}
function genesis_upgrade()
{
    // Don't do anything if we're on the latest version
    if (version_compare(genesis_get_option('theme_version'), PARENT_THEME_VERSION, '>=')) {
        return;
    }
    #########################
    #	UPGRADE TO VERSION 1.0.1
    #########################
    // Check to see if we need to upgrade to 1.0.1
    if (version_compare(genesis_get_option('theme_version'), '1.0.1', '<')) {
        $theme_settings = get_option(GENESIS_SETTINGS_FIELD);
        $new_settings = array('nav_home' => 1, 'nav_twitter_text' => 'Follow me on Twitter', 'subnav_home' => 1, 'theme_version' => '1.0.1');
        $settings = wp_parse_args($new_settings, $theme_settings);
        update_option(GENESIS_SETTINGS_FIELD, $settings);
    }
    #########################
    #	UPGRADE TO VERSION 1.1
    #########################
    // Check to see if we need to upgrade to 1.1
    if (version_compare(genesis_get_option('theme_version'), '1.1', '<')) {
        $theme_settings = get_option(GENESIS_SETTINGS_FIELD);
        $new_settings = array('content_archive_thumbnail' => genesis_get_option('thumbnail'), 'theme_version' => '1.1');
        $settings = wp_parse_args($new_settings, $theme_settings);
        update_option(GENESIS_SETTINGS_FIELD, $settings);
    }
    #########################
    #	UPGRADE TO VERSION 1.1.2
    #########################
    // Check to see if we need to upgrade to 1.1.2
    if (version_compare(genesis_get_option('theme_version'), '1.1.2', '<')) {
        $theme_settings = get_option(GENESIS_SETTINGS_FIELD);
        $new_settings = array('header_right' => genesis_get_option('header_full') ? 0 : 1, 'nav_superfish' => 1, 'subnav_superfish' => 1, 'nav_extras_enable' => genesis_get_option('nav_right') ? 1 : 0, 'nav_extras' => genesis_get_option('nav_right'), 'nav_extras_twitter_id' => genesis_get_option('twitter_id'), 'nav_extras_twitter_text' => genesis_get_option('nav_twitter_text'), 'theme_version' => '1.1.2');
        $settings = wp_parse_args($new_settings, $theme_settings);
        update_option(GENESIS_SETTINGS_FIELD, $settings);
    }
    #########################
    #	UPGRADE TO VERSION 1.2
    #########################
    // Check to see if we need to upgrade to 1.2
    if (version_compare(genesis_get_option('theme_version'), '1.2', '<')) {
        $theme_settings = get_option(GENESIS_SETTINGS_FIELD);
        $new_settings = array('update' => 1, 'theme_version' => '1.2');
        $settings = wp_parse_args($new_settings, $theme_settings);
        update_option(GENESIS_SETTINGS_FIELD, $settings);
    }
    #########################
    #	UPGRADE TO VERSION 1.3
    #########################
    // Check to see if we need to upgrade to 1.3
    if (version_compare(genesis_get_option('theme_version'), '1.3', '<')) {
        //	upgrade theme settings
        $theme_settings = get_option(GENESIS_SETTINGS_FIELD);
        $new_settings = array('author_box_single' => genesis_get_option('author_box'), 'theme_version' => '1.3');
        $settings = wp_parse_args($new_settings, $theme_settings);
        update_option(GENESIS_SETTINGS_FIELD, $settings);
        //	upgrade SEO settings
        $seo_settings = get_option(GENESIS_SEO_SETTINGS_FIELD);
        $new_settings = array('noindex_cat_archive' => genesis_get_seo_option('index_cat_archive') ? 0 : 1, 'noindex_tag_archive' => genesis_get_seo_option('index_tag_archive') ? 0 : 1, 'noindex_author_archive' => genesis_get_seo_option('index_author_archive') ? 0 : 1, 'noindex_date_archive' => genesis_get_seo_option('index_date_archive') ? 0 : 1, 'noindex_search_archive' => genesis_get_seo_option('index_search_archive') ? 0 : 1, 'noodp' => 1, 'noydir' => 1, 'canonical_archives' => 1);
        $settings = wp_parse_args($new_settings, $seo_settings);
        update_option(GENESIS_SEO_SETTINGS_FIELD, $settings);
        //	delete the store transient, force refresh
        delete_transient('genesis-remote-store');
    }
    #########################
    #	UPGRADE TO VERSION 1.5
    #########################
    // Check to see if we need to upgrade to 1.5
    if (version_compare(genesis_get_option('theme_version'), '1.5', '<')) {
        $theme_settings = get_option(GENESIS_SETTINGS_FIELD);
        $new_settings = array('theme_version' => '1.5');
        $settings = wp_parse_args($new_settings, $theme_settings);
        update_option(GENESIS_SETTINGS_FIELD, $settings);
    }
    #########################
    #	REFRESH TO LOAD NEW DATA
    #########################
    wp_redirect(admin_url('admin.php?page=genesis&upgraded=true'));
    exit;
}
Beispiel #15
0
/**
 * Echo custom canonical link tag.
 *
 * Remove the default WordPress canonical tag, and use our custom
 * one. Gives us more flexibility and effectiveness.
 *
 * @since 0.1.3
 *
 * @uses genesis_get_seo_option() Get SEO setting value
 * @uses genesis_get_custom_field() Get custom field value
 *
 * @global WP_Query $wp_query
 * @return null Returns null on failure to determine queried object
 */
function genesis_canonical()
{
    /** Remove the WordPress canonical */
    remove_action('wp_head', 'rel_canonical');
    global $wp_query;
    $canonical = '';
    if (is_front_page()) {
        $canonical = trailingslashit(home_url());
    }
    if (is_singular()) {
        if (!($id = $wp_query->get_queried_object_id())) {
            return;
        }
        $cf = genesis_get_custom_field('_genesis_canonical_uri');
        $canonical = $cf ? $cf : get_permalink($id);
    }
    if (is_category() || is_tag() || is_tax()) {
        if (!($id = $wp_query->get_queried_object_id())) {
            return;
        }
        $taxonomy = $wp_query->queried_object->taxonomy;
        $canonical = genesis_get_seo_option('canonical_archives') ? get_term_link((int) $id, $taxonomy) : 0;
    }
    if (is_author()) {
        if (!($id = $wp_query->get_queried_object_id())) {
            return;
        }
        $canonical = genesis_get_seo_option('canonical_archives') ? get_author_posts_url($id) : 0;
    }
    if ($canonical) {
        printf('<link rel="canonical" href="%s" />' . "\n", esc_url(apply_filters('genesis_canonical', $canonical)));
    }
}
/**
 * The Genesis-specific post tags link
 *
 * @since 0.2.3
 */
function genesis_post_tags_link($sep = ', ', $label = '')
{
    $label = !empty($label) ? trim($label) . ' ' : '';
    $links = get_the_tag_list($label, $sep);
    $links = genesis_get_seo_option('nofollow_tag_link') ? genesis_rel_nofollow($links) : $links;
    echo sprintf('<span class="tags">%s</span> ', $links);
}
Beispiel #17
0
/**
 * Echo the site description into the header.
 *
 * Depending on the SEO option set by the user, this will either be wrapped in an `h1` or `p` element.
 *
 * Applies the `genesis_seo_description` filter before echoing.
 *
 * @since 1.1.0
 */
function genesis_seo_site_description()
{
    // Set what goes inside the wrapping tags.
    $inside = esc_html(get_bloginfo('description'));
    // Determine which wrapping tags to use.
    $wrap = genesis_is_root_page() && 'description' === genesis_get_seo_option('home_h1_on') ? 'h1' : 'p';
    // Wrap homepage site description in p tags if static front page.
    $wrap = is_front_page() && !is_home() ? 'p' : $wrap;
    // And finally, $wrap in h2 if HTML5 & semantic headings enabled.
    $wrap = genesis_html5() && genesis_get_seo_option('semantic_headings') ? 'h2' : $wrap;
    /**
     * Site description wrapping element
     *
     * The wrapping element for the site description.
     *
     * @since 2.2.3
     *
     * @param string $wrap The wrapping element (h1, h2, p, etc.).
     */
    $wrap = apply_filters('genesis_site_description_wrap', $wrap);
    // Build the description.
    $description = genesis_markup(array('open' => sprintf("<{$wrap} %s>", genesis_attr('site-description')), 'close' => "</{$wrap}>", 'content' => $inside, 'context' => 'site-description', 'echo' => false, 'params' => array('wrap' => $wrap)));
    // Output (filtered).
    $output = $inside ? apply_filters('genesis_seo_description', $description, $inside, $wrap) : '';
    echo $output;
}
function genesis_seo_settings_canonical_box()
{
    ?>
	<p><?php 
    _e('Would you like to enable use of the canonical tag?', 'genesis');
    ?>
</p>
	<p><label><input type="radio" name="<?php 
    echo GENESIS_SEO_SETTINGS_FIELD;
    ?>
[enable_canonical]" value="1" <?php 
    checked(1, genesis_get_seo_option('enable_canonical'));
    ?>
 />
	<?php 
    _e('Yes', 'genesis');
    ?>
</label>
	<label><input type="radio" name="<?php 
    echo GENESIS_SEO_SETTINGS_FIELD;
    ?>
[enable_canonical]" value="0" <?php 
    checked(0, genesis_get_seo_option('enable_canonical'));
    ?>
 />
	<?php 
    _e('No', 'genesis');
    ?>
</label></p>
	<p><span class="description"><strong><?php 
    _e("Note: ", 'genesis');
    ?>
</strong><?php 
    _e('The Canonical Tag is used to inform search engines of the proper URL to index when they crawl your site.', 'genesis');
    ?>
</p>
<?php 
}
/**
 * Echo the site description into the header.
 *
 * Depending on the SEO option set by the user, this will either be wrapped in an `h1` or `p` element.
 *
 * Applies the `genesis_seo_description` filter before echoing.
 *
 * @since 1.1.0
 *
 * @uses genesis_get_seo_option() Get SEO setting value.
 * uses genesis_html5()           Check for HTML5 support.
 */
function genesis_seo_site_description()
{
    //* Set what goes inside the wrapping tags
    $inside = esc_html(get_bloginfo('description'));
    //* Determine which wrapping tags to use
    $wrap = is_home() && 'description' === genesis_get_seo_option('home_h1_on') ? 'h1' : 'p';
    //* And finally, $wrap in h2 if HTML5 & semantic headings enabled
    $wrap = genesis_html5() && genesis_get_seo_option('semantic_headings') ? 'h2' : $wrap;
    //* Build the description
    $description = genesis_html5() ? sprintf("<{$wrap} %s>", genesis_attr('site-description')) : sprintf('<%s id="description">%s</%s>', $wrap, $inside, $wrap);
    $description .= genesis_html5() ? "{$inside}</{$wrap}>" : '';
    //* Output (filtered)
    $output = $inside ? apply_filters('genesis_seo_description', $description, $inside, $wrap) : '';
    echo $output;
}
function genesis_seo_settings_robots_meta_box()
{
    ?>
	
	<p><span class="description"><?php 
    _e('Depending on your situation, you may or may not want the following archive pages to be indexed by search engines. Only you can make that determination.', 'genesis');
    ?>
</span></p>
	
	<p><label><input type="checkbox" name="<?php 
    echo GENESIS_SEO_SETTINGS_FIELD;
    ?>
[noindex_cat_archive]" value="1" <?php 
    checked(1, genesis_get_seo_option('noindex_cat_archive'));
    ?>
 /> <?php 
    printf(__('Apply %s to Category Archives?', 'genesis'), '<code>noindex</code>');
    ?>
</label><br />
	<label><input type="checkbox" name="<?php 
    echo GENESIS_SEO_SETTINGS_FIELD;
    ?>
[noindex_tag_archive]" value="1" <?php 
    checked(1, genesis_get_seo_option('noindex_tag_archive'));
    ?>
 /> <?php 
    printf(__('Apply %s to Tag Archives?', 'genesis'), '<code>noindex</code>');
    ?>
</label><br />
	<label><input type="checkbox" name="<?php 
    echo GENESIS_SEO_SETTINGS_FIELD;
    ?>
[noindex_author_archive]" value="1" <?php 
    checked(1, genesis_get_seo_option('noindex_author_archive'));
    ?>
 /> <?php 
    printf(__('Apply %s to Author Archives?', 'genesis'), '<code>noindex</code>');
    ?>
</label><br />
	<label><input type="checkbox" name="<?php 
    echo GENESIS_SEO_SETTINGS_FIELD;
    ?>
[noindex_date_archive]" value="1" <?php 
    checked(1, genesis_get_seo_option('noindex_date_archive'));
    ?>
 /> <?php 
    printf(__('Apply %s to Date Archives?', 'genesis'), '<code>noindex</code>');
    ?>
</label><br />
	<label><input type="checkbox" name="<?php 
    echo GENESIS_SEO_SETTINGS_FIELD;
    ?>
[noindex_search_archive]" value="1" <?php 
    checked(1, genesis_get_seo_option('noindex_search_archive'));
    ?>
 /> <?php 
    printf(__('Apply %s to Search Archives?', 'genesis'), '<code>noindex</code>');
    ?>
</label></p>
	
	<p><span class="description"><?php 
    printf(__('Some search engines will cache pages in your site (e.g Google Cache). The %1$s tag will prevent them from doing so. Choose what archives you want to %1$s.', 'genesis'), '<code>noarchive</code>');
    ?>
</span></p>
	
	<p><label><input type="checkbox" name="<?php 
    echo GENESIS_SEO_SETTINGS_FIELD;
    ?>
[noarchive]" value="1" <?php 
    checked(1, genesis_get_seo_option('noarchive'));
    ?>
 /> <?php 
    printf(__('Apply %s to Entire Site?', 'genesis'), '<code>noarchive</code>');
    ?>
</label></p>
	
	<p><label><input type="checkbox" name="<?php 
    echo GENESIS_SEO_SETTINGS_FIELD;
    ?>
[noarchive_cat_archive]" value="1" <?php 
    checked(1, genesis_get_seo_option('noarchive_cat_archive'));
    ?>
 /> <?php 
    printf(__('Apply %s to Category Archives?', 'genesis'), '<code>noarchive</code>');
    ?>
</label><br />
	<label><input type="checkbox" name="<?php 
    echo GENESIS_SEO_SETTINGS_FIELD;
    ?>
[noarchive_tag_archive]" value="1" <?php 
    checked(1, genesis_get_seo_option('noarchive_tag_archive'));
    ?>
 /> <?php 
    printf(__('Apply %s to Tag Archives?', 'genesis'), '<code>noarchive</code>');
    ?>
</label><br />
	<label><input type="checkbox" name="<?php 
    echo GENESIS_SEO_SETTINGS_FIELD;
    ?>
[noarchive_author_archive]" value="1" <?php 
    checked(1, genesis_get_seo_option('noarchive_author_archive'));
    ?>
 /> <?php 
    printf(__('Apply %s to Author Archives?', 'genesis'), '<code>noarchive</code>');
    ?>
</label><br />
	<label><input type="checkbox" name="<?php 
    echo GENESIS_SEO_SETTINGS_FIELD;
    ?>
[noarchive_date_archive]" value="1" <?php 
    checked(1, genesis_get_seo_option('noarchive_date_archive'));
    ?>
 /> <?php 
    printf(__('Apply %s to Date Archives?', 'genesis'), '<code>noarchive</code>');
    ?>
</label><br />
	<label><input type="checkbox" name="<?php 
    echo GENESIS_SEO_SETTINGS_FIELD;
    ?>
[noarchive_search_archive]" value="1" <?php 
    checked(1, genesis_get_seo_option('noarchive_search_archive'));
    ?>
 /> <?php 
    printf(__('Apply %s to Search Archives?', 'genesis'), '<code>noarchive</code>');
    ?>
</label></p>
	
	<p><span class="description"><?php 
    printf(__('Occasionally, search engines use resources like the Open Directory Project and the Yahoo! Directory to find titles and descriptions for your content. Generally, you will not want them to do this. The %s and %s tags prevent them from doing so.', 'genesis'), '<code>noodp</code>', '<code>noydir</code>');
    ?>
</span></p>
	
	<p>
		<label><input type="checkbox" name="<?php 
    echo GENESIS_SEO_SETTINGS_FIELD;
    ?>
[noodp]" value="1" <?php 
    checked(1, genesis_get_seo_option('noodp'));
    ?>
 /> <?php 
    printf(__('Apply %s to your site?', 'genesis'), '<code>noodp</code>');
    ?>
</label><br />
		<label><input type="checkbox" name="<?php 
    echo GENESIS_SEO_SETTINGS_FIELD;
    ?>
[noydir]" value="1" <?php 
    checked(1, genesis_get_seo_option('noydir'));
    ?>
 /> <?php 
    printf(__('Apply %s to your site?', 'genesis'), '<code>noydir</code>');
    ?>
</label>
	<p>
	
<?php 
}
Beispiel #21
0
/**
 * Echo the site description into the header.
 *
 * Depending on the SEO option set by the user, this will either be wrapped in an `h1` or `p` element.
 *
 * Applies the `genesis_seo_description` filter before echoing.
 *
 * @since 1.1.0
 *
 * @uses genesis_get_seo_option() Get SEO setting value.
 * uses genesis_html5()           Check for HTML5 support.
 */
function genesis_seo_site_description()
{
    //* Set what goes inside the wrapping tags
    $inside = esc_html(get_bloginfo('description'));
    //* Determine which wrapping tags to use
    $wrap = genesis_is_root_page() && 'description' === genesis_get_seo_option('home_h1_on') ? 'h1' : 'p';
    //* Wrap homepage site description in p tags if static front page
    $wrap = is_front_page() && !is_home() ? 'p' : $wrap;
    //* And finally, $wrap in h2 if HTML5 & semantic headings enabled
    $wrap = genesis_html5() && genesis_get_seo_option('semantic_headings') ? 'h2' : $wrap;
    /**
     * Site description wrapping element
     *
     * The wrapping element for the site description.
     *
     * @since 2.2.3
     *
     * @param string $wrap The wrapping element (h1, h2, p, etc.).
     */
    $wrap = apply_filters('genesis_site_description_wrap', $wrap);
    //* Build the description
    $description = genesis_html5() ? sprintf("<{$wrap} %s>", genesis_attr('site-description')) : sprintf('<%s id="description">%s</%s>', $wrap, $inside, $wrap);
    $description .= genesis_html5() ? "{$inside}</{$wrap}>" : '';
    //* Output (filtered)
    $output = $inside ? apply_filters('genesis_seo_description', $description, $inside, $wrap) : '';
    echo $output;
}
Beispiel #22
0
/**
 * Determine the `noindex`, `nofollow`, `noodp`, `noydir`, `noarchive` robots meta code for the current context.
 *
 * @since 2.4.0
 *
 * @global WP_Query $wp_query Query object.
 *
 * @return string String for `content` attribute of `robots` meta tag.
 */
function genesis_get_robots_meta_content()
{
    global $wp_query;
    $post_id = null;
    // Defaults.
    $directives = array('noindex' => '', 'nofollow' => '', 'noarchive' => genesis_get_seo_option('noarchive') ? 'noarchive' : '', 'noodp' => genesis_get_seo_option('noodp') ? 'noodp' : '', 'noydir' => genesis_get_seo_option('noydir') ? 'noydir' : '');
    // Check root page SEO settings, set noindex, nofollow and noarchive.
    if (genesis_is_root_page()) {
        $directives['noindex'] = genesis_get_seo_option('home_noindex') ? 'noindex' : $directives['noindex'];
        $directives['nofollow'] = genesis_get_seo_option('home_nofollow') ? 'nofollow' : $directives['nofollow'];
        $directives['noarchive'] = genesis_get_seo_option('home_noarchive') ? 'noarchive' : $directives['noarchive'];
    }
    // When the page is set as the Posts Page in WordPress core, use the $post_id of the page when loading SEO values.
    if (is_home() && get_option('page_for_posts') && get_queried_object_id()) {
        $post_id = get_option('page_for_posts');
    }
    if (is_singular() || null !== $post_id) {
        $directives['noindex'] = genesis_get_custom_field('_genesis_noindex', $post_id) ? 'noindex' : $directives['noindex'];
        $directives['nofollow'] = genesis_get_custom_field('_genesis_nofollow', $post_id) ? 'nofollow' : $directives['nofollow'];
        $directives['noarchive'] = genesis_get_custom_field('_genesis_noarchive', $post_id) ? 'noarchive' : $directives['noarchive'];
    } elseif (is_category() || is_tag() || is_tax()) {
        $term = $wp_query->get_queried_object();
        $directives['noindex'] = get_term_meta($term->term_id, 'noindex', true) ? 'noindex' : $directives['noindex'];
        $directives['nofollow'] = get_term_meta($term->term_id, 'nofollow', true) ? 'nofollow' : $directives['nofollow'];
        $directives['noarchive'] = get_term_meta($term->term_id, 'noarchive', true) ? 'noarchive' : $directives['noarchive'];
        if (is_category()) {
            $directives['noindex'] = genesis_get_seo_option('noindex_cat_archive') ? 'noindex' : $directives['noindex'];
            $directives['noarchive'] = genesis_get_seo_option('noarchive_cat_archive') ? 'noarchive' : $directives['noarchive'];
        } elseif (is_tag()) {
            $directives['noindex'] = genesis_get_seo_option('noindex_tag_archive') ? 'noindex' : $directives['noindex'];
            $directives['noarchive'] = genesis_get_seo_option('noarchive_tag_archive') ? 'noarchive' : $directives['noarchive'];
        }
    } elseif (is_post_type_archive() && genesis_has_post_type_archive_support()) {
        $directives['noindex'] = genesis_get_cpt_option('noindex') ? 'noindex' : $directives['noindex'];
        $directives['nofollow'] = genesis_get_cpt_option('nofollow') ? 'nofollow' : $directives['nofollow'];
        $directives['noarchive'] = genesis_get_cpt_option('noarchive') ? 'noarchive' : $directives['noarchive'];
    } elseif (is_author()) {
        $directives['noindex'] = get_the_author_meta('noindex', (int) get_query_var('author')) ? 'noindex' : $directives['noindex'];
        $directives['nofollow'] = get_the_author_meta('nofollow', (int) get_query_var('author')) ? 'nofollow' : $directives['nofollow'];
        $directives['noarchive'] = get_the_author_meta('noarchive', (int) get_query_var('author')) ? 'noarchive' : $directives['noarchive'];
        $directives['noindex'] = genesis_get_seo_option('noindex_author_archive') ? 'noindex' : $directives['noindex'];
        $directives['noarchive'] = genesis_get_seo_option('noarchive_author_archive') ? 'noarchive' : $directives['noarchive'];
    } elseif (is_date()) {
        $directives['noindex'] = genesis_get_seo_option('noindex_date_archive') ? 'noindex' : $directives['noindex'];
        $directives['noarchive'] = genesis_get_seo_option('noarchive_date_archive') ? 'noarchive' : $directives['noarchive'];
    } elseif (is_search()) {
        $directives['noindex'] = genesis_get_seo_option('noindex_search_archive') ? 'noindex' : $directives['noindex'];
        $directives['noarchive'] = genesis_get_seo_option('noarchive_search_archive') ? 'noarchive' : $directives['noarchive'];
    }
    /**
     * Filter the array of directives for the robots meta tag.
     *
     * @since 2.4.0
     *
     * @param array $directives May contain keys for `noindex`, `nofollow`, `noodp`, `noydir`, `noarchive`.
     */
    $directives = apply_filters('genesis_get_robots_meta_content', $directives);
    // Strip empty array items.
    $directives = array_filter($directives);
    return implode(',', $directives);
}
Beispiel #23
0
function genesischild_swap_header($title, $inside, $wrap)
{
    //* Set what goes inside the wrapping tags
    if (get_header_image()) {
        $logo = '<img  src="' . get_header_image() . '" width="' . esc_attr(get_custom_header()->width) . '" height="' . esc_attr(get_custom_header()->height) . '" alt="' . esc_attr(get_bloginfo('name')) . '">';
    } else {
        $logo = get_bloginfo('name');
    }
    $inside = sprintf('<a href="%s" title="%s">%s</a>', trailingslashit(home_url()), esc_attr(get_bloginfo('name')), $logo);
    //* Determine which wrapping tags to use - changed is_home to is_front_page to fix Genesis bug
    $wrap = is_front_page() && 'title' === genesis_get_seo_option('home_h1_on') ? 'h1' : 'p';
    //* A little fallback, in case an SEO plugin is active - changed is_home to is_front_page to fix Genesis bug
    $wrap = is_front_page() && !genesis_get_seo_option('home_h1_on') ? 'h1' : $wrap;
    //* And finally, $wrap in h1 if HTML5 & semantic headings enabled
    $wrap = genesis_html5() && genesis_get_seo_option('semantic_headings') ? 'h1' : $wrap;
    return sprintf('<%1$s %2$s>%3$s</%1$s>', $wrap, genesis_attr('site-title'), $inside);
}
function genesis_inpost_seo_box()
{
    ?>
	
	<input type="hidden" name="genesis_inpost_seo_nonce" value="<?php 
    echo wp_create_nonce(plugin_basename(__FILE__));
    ?>
" />
	
	<p><label for="genesis_title"><b>Custom Document Title</b> (<code>&lt;title&gt;</code> Tag):</label></p>
	<p><input style="width: 99%;" type="text" name="genesis_seo[_genesis_title]" id="genesis_title" value="<?php 
    echo esc_attr(genesis_get_custom_field('_genesis_title'));
    ?>
" /></p>
	
	<p><label for="genesis_description"><b>Custom Post/Page Meta Description</b> (<code>&lt;meta name="description"&gt;</code>):</label></p>
	<p><textarea style="width: 99%;" name="genesis_seo[_genesis_description]" id="genesis_description"><?php 
    echo htmlspecialchars(genesis_get_custom_field('_genesis_description'));
    ?>
</textarea></p>
	
	<p><label for="genesis_keywords"><b>Custom Post/Page Meta Keywords</b> (<code>&lt;meta name="keywords"&gt;</code>, comma separated):</label></p>
	<p><input style="width: 99%;" type="text" name="genesis_seo[_genesis_keywords]" id="genesis_keywords" value="<?php 
    echo esc_attr(genesis_get_custom_field('_genesis_keywords'));
    ?>
" /></p>
	
	<br />
	
	<p><b>Noindex this Post/Page</b> ( <a href="http://www.robotstxt.org/meta.html" target="_blank">more info</a> )</p>
	<p><input type="checkbox" name="genesis_seo[_genesis_noindex]" id="genesis_noindex" value="1" <?php 
    checked(1, genesis_get_custom_field('_genesis_noindex'));
    ?>
 /> 
	<label for="genesis_noindex">Apply <code>noindex</code> to this post/page?</label></p>
	
	<br />
	
	<p><b>Nofollow this Post/Page</b> ( <a href="http://www.robotstxt.org/meta.html" target="_blank">more info</a> )</p>
	<p><input type="checkbox" name="genesis_seo[_genesis_nofollow]" id="genesis_nofollow" value="1" <?php 
    checked(1, genesis_get_custom_field('_genesis_nofollow'));
    ?>
 /> 
	<label for="genesis_nofollow">Apply <code>nofollow</code> to this post/page?</label></p>
	
<?php 
    if (!genesis_get_seo_option('disable_canonical')) {
        ?>
	<br />
	<p><b>Remove canonical tag</b> ( <a href="http://www.mattcutts.com/blog/canonical-link-tag/" target="_blank">more info</a> )</p>
	<p><input type="checkbox" name="genesis_seo[_genesis_disable_canonical]" id="genesis_disable_canonical" value="1" <?php 
        checked(1, genesis_get_custom_field('_genesis_disable_canonical'));
        ?>
 /> 
	<label for="genesis_disable_canonical">Disable the <code>&lt;link rel="canonical" /&gt;</code> tag for this post/page?</label>
<?php 
    }
}
/**
 * Update Genesis to the latest version.
 *
 * This iterative update function will take a Genesis installation, no matter
 * how old, and update its options to the latest version.
 *
 * It used to iterate over theme version, but now uses a database version
 * system, which allows for changes within pre-releases, too.
 *
 * @since 1.0.1
 *
 * @uses _genesis_vestige()
 * @uses genesis_get_option()     Get theme setting value.
 * @uses genesis_get_seo_option() Get SEO setting value.
 * @uses genesis_upgrade_1700()
 * @uses genesis_upgrade_1800()
 * @uses genesis_upgrade_1901()
 * @uses genesis_upgrade_2001()
 * @uses genesis_upgrade_2003()
 * @uses PARENT_DB_VERSION
 * @uses GENESIS_SETTINGS_FIELD
 * @uses GENESIS_SEO_SETTINGS_FIELD
 *
 * @return null Return early if we're already on the latest version.
 */
function genesis_upgrade()
{
    //* Don't do anything if we're on the latest version
    if (genesis_get_option('db_version', null, false) >= PARENT_DB_VERSION) {
        return;
    }
    #########################
    # UPDATE TO VERSION 1.0.1
    #########################
    if (version_compare(genesis_get_option('theme_version', null, false), '1.0.1', '<')) {
        $theme_settings = get_option(GENESIS_SETTINGS_FIELD);
        $new_settings = array('nav_home' => 1, 'nav_twitter_text' => 'Follow me on Twitter', 'subnav_home' => 1, 'theme_version' => '1.0.1');
        $settings = wp_parse_args($new_settings, $theme_settings);
        update_option(GENESIS_SETTINGS_FIELD, $settings);
    }
    #########################
    # UPDATE TO VERSION 1.1
    #########################
    if (version_compare(genesis_get_option('theme_version', null, false), '1.1', '<')) {
        $theme_settings = get_option(GENESIS_SETTINGS_FIELD);
        $new_settings = array('content_archive_thumbnail' => genesis_get_option('thumbnail'), 'theme_version' => '1.1');
        $settings = wp_parse_args($new_settings, $theme_settings);
        update_option(GENESIS_SETTINGS_FIELD, $settings);
    }
    #########################
    # UPDATE TO VERSION 1.1.2
    #########################
    if (version_compare(genesis_get_option('theme_version', null, false), '1.1.2', '<')) {
        $theme_settings = get_option(GENESIS_SETTINGS_FIELD);
        $new_settings = array('header_right' => genesis_get_option('header_full') ? 0 : 1, 'nav_superfish' => 1, 'subnav_superfish' => 1, 'nav_extras_enable' => genesis_get_option('nav_right') ? 1 : 0, 'nav_extras' => genesis_get_option('nav_right'), 'nav_extras_twitter_id' => genesis_get_option('twitter_id'), 'nav_extras_twitter_text' => genesis_get_option('nav_twitter_text'), 'theme_version' => '1.1.2');
        $settings = wp_parse_args($new_settings, $theme_settings);
        update_option(GENESIS_SETTINGS_FIELD, $settings);
    }
    #########################
    # UPDATE TO VERSION 1.2
    #########################
    if (version_compare(genesis_get_option('theme_version', null, false), '1.2', '<')) {
        $theme_settings = get_option(GENESIS_SETTINGS_FIELD);
        $new_settings = array('update' => 1, 'theme_version' => '1.2');
        $settings = wp_parse_args($new_settings, $theme_settings);
        update_option(GENESIS_SETTINGS_FIELD, $settings);
    }
    #########################
    # UPDATE TO VERSION 1.3
    #########################
    if (version_compare(genesis_get_option('theme_version', null, false), '1.3', '<')) {
        //* Update theme settings
        $theme_settings = get_option(GENESIS_SETTINGS_FIELD);
        $new_settings = array('author_box_single' => genesis_get_option('author_box'), 'theme_version' => '1.3');
        $settings = wp_parse_args($new_settings, $theme_settings);
        update_option(GENESIS_SETTINGS_FIELD, $settings);
        //* Update SEO settings
        $seo_settings = get_option(GENESIS_SEO_SETTINGS_FIELD);
        $new_settings = array('noindex_cat_archive' => genesis_get_seo_option('index_cat_archive') ? 0 : 1, 'noindex_tag_archive' => genesis_get_seo_option('index_tag_archive') ? 0 : 1, 'noindex_author_archive' => genesis_get_seo_option('index_author_archive') ? 0 : 1, 'noindex_date_archive' => genesis_get_seo_option('index_date_archive') ? 0 : 1, 'noindex_search_archive' => genesis_get_seo_option('index_search_archive') ? 0 : 1, 'noodp' => 1, 'noydir' => 1, 'canonical_archives' => 1);
        $settings = wp_parse_args($new_settings, $seo_settings);
        update_option(GENESIS_SEO_SETTINGS_FIELD, $settings);
        //* Delete the store transient, force refresh
        delete_transient('genesis-remote-store');
    }
    #########################
    # UPDATE TO VERSION 1.6
    #########################
    if (version_compare(genesis_get_option('theme_version', null, false), '1.6', '<')) {
        //* Vestige nav settings, for backward compatibility
        if ('nav-menu' !== genesis_get_option('nav_type')) {
            _genesis_vestige(array('nav_type', 'nav_superfish', 'nav_home', 'nav_pages_sort', 'nav_categories_sort', 'nav_depth', 'nav_exclude', 'nav_include'));
        }
        //* Vestige subnav settings, for backward compatibility
        if ('nav-menu' !== genesis_get_option('subnav_type')) {
            _genesis_vestige(array('subnav_type', 'subnav_superfish', 'subnav_home', 'subnav_pages_sort', 'subnav_categories_sort', 'subnav_depth', 'subnav_exclude', 'subnav_include'));
        }
        $theme_settings = get_option(GENESIS_SETTINGS_FIELD);
        $new_settings = array('theme_version' => '1.6');
        $settings = wp_parse_args($new_settings, $theme_settings);
        update_option(GENESIS_SETTINGS_FIELD, $settings);
    }
    ###########################
    # UPDATE DB TO VERSION 1700
    ###########################
    if (genesis_get_option('db_version', null, false) < '1700') {
        genesis_upgrade_1700();
    }
    ###########################
    # UPDATE DB TO VERSION 1800
    ###########################
    if (genesis_get_option('db_version', null, false) < '1800') {
        genesis_upgrade_1800();
    }
    ###########################
    # UPDATE DB TO VERSION 1901
    ###########################
    if (genesis_get_option('db_version', null, false) < '1901') {
        genesis_upgrade_1901();
    }
    ###########################
    # UPDATE DB TO VERSION 2001
    ###########################
    if (genesis_get_option('db_version', null, false) < '2001') {
        genesis_upgrade_2001();
    }
    ###########################
    # UPDATE DB TO VERSION 2003
    ###########################
    if (genesis_get_option('db_version', null, false) < '2003') {
        genesis_upgrade_2003();
    }
    ###########################
    # UPDATE DB TO VERSION 2100
    ###########################
    if (genesis_get_option('db_version', null, false) < '2100') {
        genesis_upgrade_2100();
    }
    ###########################
    # UPDATE DB TO VERSION 2201
    ###########################
    if (genesis_get_option('db_version', null, false) < '2201') {
        genesis_upgrade_2201();
    }
    ###########################
    # UPDATE DB TO VERSION 2205
    ###########################
    if (genesis_get_option('db_version', null, false) < '2205') {
        genesis_upgrade_2205();
    }
    do_action('genesis_upgrade');
}
Beispiel #26
0
/**
 * Echo the title of a post.
 *
 * The `genesis_post_title_text` filter is applied on the text of the title, while the `genesis_post_title_output`
 * filter is applied on the echoed markup.
 *
 * @since 1.1.0
 *
 * @uses genesis_html5()          Check for HTML5 support.
 * @uses genesis_get_SEO_option() Get SEO setting value.
 * @uses genesis_markup()         Contextual markup.
 *
 * @return null Return early if the length of the title string is zero.
 */
function genesis_do_post_title()
{
    $title = apply_filters('genesis_post_title_text', get_the_title());
    if (0 === mb_strlen($title)) {
        return;
    }
    //* Link it, if necessary
    if (!is_singular() && apply_filters('genesis_link_post_title', true)) {
        $title = sprintf('<a href="%s" title="%s" rel="bookmark">%s</a>', get_permalink(), the_title_attribute('echo=0'), $title);
    }
    //* Wrap in H1 on singular pages
    $wrap = is_singular() ? 'h1' : 'h2';
    //* Also, if HTML5 with semantic headings, wrap in H1
    $wrap = genesis_html5() && genesis_get_seo_option('semantic_headings') ? 'h1' : $wrap;
    //* Build the output
    $output = genesis_markup(array('html5' => "<{$wrap} %s>", 'xhtml' => sprintf('<%s class="entry-title">%s</%s>', $wrap, $title, $wrap), 'context' => 'entry-title', 'echo' => false));
    $output .= genesis_html5() ? "{$title}</{$wrap}>" : '';
    echo apply_filters('genesis_post_title_output', "{$output} \n");
}