Пример #1
0
 /**
  * Register meta boxes on the Theme Settings page.
  *
  * Some of the meta box additions are dependent on certain theme support or user capabilities.
  *
  * The 'genesis_theme_settings_metaboxes' action hook is called at the end of this function.
  *
  * @since 1.0.0
  *
  * @see \Genesis_Admin_Settings::info_box()          Callback for Information box.
  * @see \Genesis_Admin_Settings::style_box()         Callback for Color Style box (if supported).
  * @see \Genesis_Admin_Settings::feeds_box()         Callback for Custom Feeds box.
  * @see \Genesis_Admin_Settings::layout_box()        Callback for Default Layout box.
  * @see \Genesis_Admin_Settings::header_box()        Callback for Header box (if no custom header support).
  * @see \Genesis_Admin_Settings::nav_box()           Callback for Navigation box.
  * @see \Genesis_Admin_Settings::breadcrumb_box()    Callback for Breadcrumbs box.
  * @see \Genesis_Admin_Settings::comments_box()      Callback for Comments and Trackbacks box.
  * @see \Genesis_Admin_Settings::post_archives_box() Callback for Content Archives box.
  * @see \Genesis_Admin_Settings::blogpage_box()      Callback for Blog Page box.
  * @see \Genesis_Admin_Settings::scripts_box()       Callback for Header and Footer Scripts box (if user has
  *                                                   unfiltered_html capability).
  */
 function metaboxes()
 {
     add_action('genesis_admin_before_metaboxes', array($this, 'hidden_fields'));
     add_meta_box('genesis-theme-settings-version', __('Information', 'genesis'), array($this, 'info_box'), $this->pagehook, 'main', 'high');
     if (current_theme_supports('genesis-style-selector')) {
         add_meta_box('genesis-theme-settings-style-selector', __('Color Style', 'genesis'), array($this, 'style_box'), $this->pagehook, 'main');
     }
     add_meta_box('genesis-theme-settings-feeds', __('Custom Feeds', 'genesis'), array($this, 'feeds_box'), $this->pagehook, 'main');
     add_meta_box('genesis-theme-settings-layout', __('Default Layout', 'genesis'), array($this, 'layout_box'), $this->pagehook, 'main');
     if (!current_theme_supports('genesis-custom-header') && !current_theme_supports('custom-header')) {
         add_meta_box('genesis-theme-settings-header', __('Header', 'genesis'), array($this, 'header_box'), $this->pagehook, 'main');
     }
     if (current_theme_supports('genesis-menus') && genesis_first_version_compare('2.0.2', '<=')) {
         add_meta_box('genesis-theme-settings-nav', __('Navigation', 'genesis'), array($this, 'nav_box'), $this->pagehook, 'main');
     }
     if (current_theme_supports('genesis-breadcrumbs')) {
         add_meta_box('genesis-theme-settings-breadcrumb', __('Breadcrumbs', 'genesis'), array($this, 'breadcrumb_box'), $this->pagehook, 'main');
     }
     add_meta_box('genesis-theme-settings-comments', __('Comments and Trackbacks', 'genesis'), array($this, 'comments_box'), $this->pagehook, 'main');
     add_meta_box('genesis-theme-settings-posts', __('Content Archives', 'genesis'), array($this, 'post_archives_box'), $this->pagehook, 'main');
     add_meta_box('genesis-theme-settings-blogpage', __('Blog Page Template', 'genesis'), array($this, 'blogpage_box'), $this->pagehook, 'main');
     if (current_user_can('unfiltered_html')) {
         add_meta_box('genesis-theme-settings-scripts', __('Header and Footer Scripts', 'genesis'), array($this, 'scripts_box'), $this->pagehook, 'main');
     }
     do_action('genesis_theme_settings_metaboxes', $this->pagehook);
 }
/**
 * Filter the Primary Navigation menu items, appending either RSS links, search form, twitter link, or today's date.
 *
 * @since 1.0.0
 *
 * @uses genesis_get_option()            Get navigation extras settings.
 * @uses genesis_first_version_compare() Detect fresh install.
 *
 * @param string   $menu HTML string of list items.
 * @param stdClass $args Menu arguments.
 *
 * @return string Amended HTML string of list items.
 */
function genesis_nav_right($menu, stdClass $args)
{
    //* Only allow if using 2.0.2 or lower
    if (genesis_first_version_compare('2.0.2', '>')) {
        return $menu;
    }
    if (!genesis_get_option('nav_extras') || 'primary' !== $args->theme_location) {
        return $menu;
    }
    switch (genesis_get_option('nav_extras')) {
        case 'rss':
            $rss = '<a rel="nofollow" href="' . get_bloginfo('rss2_url') . '">' . __('Posts', 'genesis') . '</a>';
            $rss .= '<a rel="nofollow" href="' . get_bloginfo('comments_rss2_url') . '">' . __('Comments', 'genesis') . '</a>';
            $menu .= '<li class="right rss">' . $rss . '</li>';
            break;
        case 'search':
            // I hate output buffering, but I have no choice
            ob_start();
            get_search_form();
            $search = ob_get_clean();
            $menu .= '<li class="right search">' . $search . '</li>';
            break;
        case 'twitter':
            $menu .= sprintf('<li class="right twitter"><a href="%s">%s</a></li>', esc_url('http://twitter.com/' . genesis_get_option('nav_extras_twitter_id')), esc_html(genesis_get_option('nav_extras_twitter_text')));
            break;
        case 'date':
            $menu .= '<li class="right date">' . date_i18n(get_option('date_format')) . '</li>';
            break;
    }
    return $menu;
}