Exemple #1
0
/**
 * Enqueue scripts and styles.
 */
function _s_scripts()
{
    /**
     * If WP is in script debug, or we pass ?script_debug in a URL - set debug to true.
     */
    $debug = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG == true || isset($_GET['script_debug']) ? true : false;
    /**
     * If we are debugging the site, use a unique version every page load so as to ensure no cache issues.
     */
    $version = '1.0.0';
    /**
     * Should we load minified scripts? Also enqueue live reload to allow for extensionless reloading.
     */
    $suffix = '.min';
    if (true === $debug) {
        $suffix = '';
        wp_enqueue_script('live-reload', '//localhost:35729/livereload.js', array(), $version, true);
    }
    wp_enqueue_style('_s-google-font', _s_font_url(), array(), null);
    wp_enqueue_style('_s-style', get_stylesheet_directory_uri() . '/style' . $suffix . '.css', array(), $version);
    wp_enqueue_script('_s-project', get_template_directory_uri() . '/assets/js/project' . $suffix . '.js', array('jquery'), $version, true);
    if (is_singular() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
}
Exemple #2
0
/**
 * Enqueue scripts and styles.
 */
function _s_scripts()
{
    /**
     * If WP is in script debug, or we pass ?script_debug in a URL - set debug to true.
     */
    $debug = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG == true || isset($_GET['script_debug']) ? true : false;
    /**
     * If we are debugging the site, use a unique version every page load so as to ensure no cache issues.
     */
    $version = '1.0.0';
    /**
     * Should we load minified files?
     */
    $suffix = true === $debug ? '' : '.min';
    // Register styles.
    wp_register_style('_s-google-font', _s_font_url(), array(), null);
    // Enqueue styles.
    wp_enqueue_style('_s-google-font');
    wp_enqueue_style('animate.css');
    wp_enqueue_style('_s-style', get_stylesheet_directory_uri() . '/style' . $suffix . '.css', array(), $version);
    // Enqueue scripts.
    wp_enqueue_script('_s-scripts', get_template_directory_uri() . '/assets/js/project' . $suffix . '.js', array('jquery'), $version, true);
    if (is_singular() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
    // Enqueue the mobile nav script
    // Since we're showing/hiding based on CSS and wp_is_mobile is wp_is_imperfect, enqueue this everywhere.
    wp_enqueue_script('_s-mobile-nav', get_template_directory_uri() . '/assets/js/mobile-nav-menu' . $suffix . '.js', array('jquery'), $version, true);
}
Exemple #3
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 _s_setup()
 {
     /*
      * Make theme available for translation.
      * Translations can be filed in the /languages/ directory.
      * If you're building a theme based on _s, use a find and replace
      * to change '_s' to the name of your theme in all the template files.
      */
     load_theme_textdomain('_s', get_template_directory() . '/languages');
     // Add default posts and comments RSS feed links to head.
     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 on posts and pages.
      *
      * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
      */
     add_theme_support('post-thumbnails');
     // This theme uses wp_nav_menu() in one location.
     register_nav_menus(array('primary' => esc_html__('Primary Menu', '_s'), 'mobile' => esc_html__('Optional Mobile Menu', '_s')));
     /*
      * Switch 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', 'gallery', 'caption'));
     // Set up the WordPress core custom background feature.
     add_theme_support('custom-background', apply_filters('_s_custom_background_args', array('default-color' => 'ffffff', 'default-image' => '')));
     // Add styles to the post editor
     add_editor_style(array('editor-style.css', _s_font_url()));
     /**
      * Enable support and set configuration options for
      * WDS Simple Page Builder.
      */
     if (class_exists('WDS_Simple_Page_Builder') && version_compare(WDS_Simple_Page_Builder::VERSION, '1.6', '>=')) {
         // Add theme support
         add_theme_support('wds-simple-page-builder');
         // Define options
         wds_page_builder_theme_support(array('hide_options' => 'disabled', 'parts_dir' => 'pagebuilder', 'parts_prefix' => 'part', 'use_wrap' => 'on', 'container' => 'section', 'container_class' => 'pagebuilder-part', 'post_types' => array('page')));
         // Define areas
         $page_builder_areas = array('hero' => array('name' => esc_html__('Hero Area', '_s')), 'before_content' => array('name' => esc_html__('Before Content Area', '_s')), 'after_content' => array('name' => esc_html__('After Content Area', '_s')));
         // Loop through and register each area
         foreach ($page_builder_areas as $page_builder_area_slug => $page_builder_area) {
             register_page_builder_area($page_builder_area_slug, $page_builder_area);
         }
     }
 }
Exemple #4
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 _s_setup()
 {
     /**
      * Make theme available for translation.
      * Translations can be filed in the /languages/ directory.
      * If you're building a theme based on _s, use a find and replace
      * to change '_s' to the name of your theme in all the template files.
      * You will also need to update the Gulpfile with the new text domain
      * and matching destination POT file.
      */
     load_theme_textdomain('_s', get_template_directory() . '/languages');
     // Add default posts and comments RSS feed links to head.
     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 on posts and pages.
      *
      * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
      */
     add_theme_support('post-thumbnails');
     // This theme uses wp_nav_menu() in one location.
     register_nav_menus(array('primary' => esc_html__('Primary Menu', '_s'), 'mobile' => esc_html__('Optional Mobile Menu', '_s')));
     /**
      * Switch 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', 'gallery', 'caption'));
     // Set up the WordPress core custom background feature.
     add_theme_support('custom-background', apply_filters('_s_custom_background_args', array('default-color' => 'ffffff', 'default-image' => '')));
     // Add styles to the post editor
     add_editor_style(array('editor-style.css', _s_font_url()));
 }