/** * Enqueue scripts and styles. */ function wpdemo_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); } // Register styles. wp_register_style('wpdemo-google-font', wpdemo_font_url(), array(), null); // Enqueue styles. wp_enqueue_style('wpdemo-google-font'); wp_enqueue_style('animate.css'); wp_enqueue_style('wpdemo-style', get_stylesheet_directory_uri() . '/style' . $suffix . '.css', array(), $version); // Enqueue scripts. wp_enqueue_script('wpdemo-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'); } }
/** * 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 wpdemo_setup() { /* * Make theme available for translation. * Translations can be filed in the /languages/ directory. * If you're building a theme based on wpdemo, use a find and replace * to change 'wpdemo' to the name of your theme in all the template files. */ load_theme_textdomain('wpdemo', 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', 'wpdemo'))); /* * 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('wpdemo_custom_background_args', array('default-color' => 'ffffff', 'default-image' => ''))); // Add styles to the post editor add_editor_style(array('editor-style.css', wpdemo_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', 'wpdemo')), 'before_content' => array('name' => esc_html__('Before Content Area', 'wpdemo')), 'after_content' => array('name' => esc_html__('After Content Area', 'wpdemo'))); // 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); } } }