Пример #1
0
/**
 * Loads the theme styles & scripts.
 *
 * @since 1.0.0
 * @link  http://codex.wordpress.org/Function_Reference/wp_enqueue_script
 * @link  http://codex.wordpress.org/Function_Reference/wp_enqueue_style
 */
function satu_enqueue()
{
    // Add custom fonts, used in the main stylesheet.
    wp_enqueue_style('satu-fonts', satu_fonts_url(), array(), null);
    // if is not a child theme and WP_DEBUG and/or SCRIPT_DEBUG turned on, load the unminified styles & script.
    if (!is_child_theme() && WP_DEBUG || SCRIPT_DEBUG) {
        // Load main stylesheet
        wp_enqueue_style('satu-style', get_stylesheet_uri(), array('dashicons'));
        // Load custom js plugins.
        wp_enqueue_script('satu-plugins', trailingslashit(get_template_directory_uri()) . 'assets/js/plugins.min.js', array('jquery'), null, true);
        // Load custom js methods.
        wp_enqueue_script('satu-main', trailingslashit(get_template_directory_uri()) . 'assets/js/main.js', array('jquery'), null, true);
        // Load js function for responsive navigation.
        wp_enqueue_script('satu-mobile-nav', trailingslashit(get_template_directory_uri()) . 'assets/js/navigation.js', array(), null, true);
    } else {
        // Load main stylesheet
        wp_enqueue_style('satu-style', trailingslashit(get_template_directory_uri()) . 'style.min.css', array('dashicons'));
        // Load custom js plugins.
        wp_enqueue_script('satu-scripts', trailingslashit(get_template_directory_uri()) . 'assets/js/satu.min.js', array('jquery'), null, true);
        // Load js function for responsive navigation.
        wp_enqueue_script('satu-mobile-nav', trailingslashit(get_template_directory_uri()) . 'assets/js/navigation.js', array(), null, true);
    }
    // If child theme is active, load the stylesheet.
    if (is_child_theme()) {
        wp_enqueue_style('satu-child-style', get_stylesheet_uri());
    }
    // Load comment-reply script.
    if (is_singular() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
    // Loads HTML5 Shiv
    wp_enqueue_script('standard-html5', trailingslashit(get_template_directory_uri()) . 'assets/js/html5shiv.min.js', array('jquery'), null, false);
    wp_script_add_data('standard-html5', 'conditional', 'lte IE 9');
}
Пример #2
0
 /**
  * Theme setup function. This function adds support for theme features and defines the default theme
  * actions and filters.
  *
  * @since 1.0.0
  */
 function satu_theme_setup()
 {
     // Make the theme available for translation.
     load_theme_textdomain('satu', trailingslashit(get_template_directory()) . 'languages');
     // Add custom stylesheet file to the TinyMCE visual editor.
     add_editor_style(array('assets/css/editor-style.css', satu_fonts_url()));
     // Add RSS feed links to <head> for posts and comments.
     add_theme_support('automatic-feed-links');
     /*
      * Let WordPress manage the document title.
      * By adding theme support, we declare that this theme does not use a
      * hard-coded <title> tag in the document head, and expect WordPress to
      * provide it for us.
      */
     add_theme_support('title-tag');
     // Enable support for Post Thumbnails.
     add_theme_support('post-thumbnails');
     // Set custom image sizes
     add_image_size('satu-featured', 692, 380, true);
     // Register custom navigation menu.
     register_nav_menus(array('primary' => esc_html__('Primary Location', 'satu')));
     /*
      * Switch default core markup for search form, comment form, and comments
      * to output valid HTML5.
      */
     add_theme_support('html5', array('comment-list', 'search-form', 'comment-form', 'gallery', 'caption'));
     // Setup the WordPress core custom background feature.
     add_theme_support('custom-background', apply_filters('satu_custom_background_args', array('default-color' => 'ffffff', 'default-image' => '')));
     /*
      * Enable support for custom header.
      */
     add_theme_support('custom-header', array('height' => 360, 'width' => 1280, 'flex-height' => true, 'header-text' => false));
     // This theme uses its own gallery styles.
     add_filter('use_default_gallery_style', '__return_false');
     // Indicate widget sidebars can use selective refresh in the Customizer.
     add_theme_support('customize-selective-refresh-widgets');
 }