示例#1
0
 /**
  * Sets up theme defaults and registers support for various WordPress features.
  *
  * Note that this function is hooked into the after_setup_theme hook, which
  * runs before the init hook. The init hook is too late for some features, such
  * as indicating support for post thumbnails.
  */
 function graphy_setup()
 {
     /*
      * Make theme available for translation.
      * Translations can be filed in the /languages/ directory.
      * If you're building a theme based on Graphy, use a find and replace
      * to change 'graphy' to the name of your theme in all the template files
      */
     load_theme_textdomain('graphy', get_template_directory() . '/languages');
     // Add default posts and comments RSS feed links to head.
     add_theme_support('automatic-feed-links');
     /*
      * Switches default core markup for search form, comment form,
      * and comments to output valid HTML5.
      */
     add_theme_support('html5', array('search-form', 'comment-form', 'comment-list'));
     /*
      * Enable support for Post Thumbnails on posts and pages.
      *
      * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
      */
     add_theme_support('post-thumbnails');
     set_post_thumbnail_size(800);
     add_image_size('graphy-page-thumbnail', 1500, 530, true);
     // This theme uses wp_nav_menu() in one location.
     register_nav_menus(array('primary' => __('Primary Menu', 'graphy')));
     // Enable support for Post Formats.
     add_theme_support('post-formats', array('aside', 'audio', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video'));
     // Setup the WordPress core custom header feature.
     add_theme_support('custom-header', apply_filters('graphy_custom_header_args', array('default-image' => '', 'width' => 1500, 'height' => 530, 'flex-height' => false, 'header-text' => false)));
     // This theme styles the visual editor to resemble the theme style.
     add_editor_style(array('css/editor-style.css', graphy_fonts_url()));
     // This theme uses its own gallery styles.
     add_filter('use_default_gallery_style', '__return_false');
 }
示例#2
0
/**
 * Enqueue scripts and styles.
 */
function graphy_scripts()
{
    wp_enqueue_style('graphy-fonts', graphy_fonts_url(), array(), null);
    wp_enqueue_style('graphy-genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.0.3');
    wp_enqueue_style('graphy-style', get_stylesheet_uri());
    if ('ja' == get_bloginfo('language')) {
        wp_enqueue_style('graphy-style-ja', get_template_directory_uri() . '/css/ja.css');
    }
    wp_enqueue_script('graphy-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20140207', true);
    wp_enqueue_script('graphy-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true);
    if (is_singular() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
    if (preg_match('/MSIE [6-8]/', $_SERVER['HTTP_USER_AGENT'])) {
        wp_enqueue_script('graphy-html5shiv', get_template_directory_uri() . '/js/html5shiv.js', array(), '3.7.0');
        wp_enqueue_script('graphy-css3-mediaqueries', get_template_directory_uri() . '/js/css3-mediaqueries.js', array(), '20100301');
    }
}