load_dependencies(); $this->widget_init(); } /** * 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. * * @return void */ public function setup() { /* * Make theme available for translation. * Translations can be filed in the /languages/ directory. */ load_theme_textdomain( 'aces', 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 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( 'menu-1' => esc_html__( 'Primary Menu', 'aces' ), // Primary Menu 'menu-2' => esc_html__( 'Topbar Menu', 'aces' ), // footer menu 'menu-3' => esc_html__( 'Footer Menu', 'aces' ), // footer menu ) ); /* * 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( 'aces_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', ) ) ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); /** * Add support for core custom logo. * * @link https://codex.wordpress.org/Theme_Logo */ add_theme_support( 'custom-logo', array( 'height' => 250, 'width' => 250, 'flex-width' => true, 'flex-height' => true, ) ); /** * Add support for core custom header. * * @link https://developer.wordpress.org/themes/functionality/custom-headers/ */ add_theme_support( 'custom-header', apply_filters( 'aces_custom_header_args', array( 'default-image' => '', 'default-text-color' => '000000', 'width' => 1920, 'height' => 300, 'flex-height' => true, ) ) ); // This variable is intended to be overruled from themes. // Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}. // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound $GLOBALS['content_width'] = apply_filters( 'aces_content_width', 640 ); } /** * Enqueue scripts and styles. * * @see https://codex.wordpress.org/Plugin_API/Action_Reference/wp_enqueue_scripts * @see https://developer.wordpress.org/reference/functions/wp_enqueue_style/ * @see https://developer.wordpress.org/reference/functions/wp_enqueue_script/ * @return void */ public function enqueue_scripts() { wp_enqueue_style( 'aces-primary-fonts', aces_primary_fonts_url() ); wp_enqueue_style( 'aces-secondary-fonts', aces_secondary_fonts_url() ); $enable_global_all_heading_typo = get_theme_mod( 'aces_global_typo_all_heading_enable'); if ( ! empty( $enable_global_all_heading_typo && $enable_global_all_heading_typo == true) ) : wp_enqueue_style( 'aces-all-heading-fonts', aces_secondary_fonts_url() ); endif; wp_enqueue_style( 'aces-bootstrap-css', get_template_directory_uri() . '/assets/css/bootstrap.min.css' ); if ( class_exists( 'WooCommerce' ) ) { wp_enqueue_style( 'aces-woocommerce-style', get_template_directory_uri() . '/assets/css/woocommerce.css' ); } wp_enqueue_style( 'aces-font-awesome-all', get_template_directory_uri() . '/assets/css/all.min.css' ); wp_enqueue_style( 'aces-stellarnav', get_template_directory_uri() . '/assets/css/stellarnav.css' ); wp_enqueue_style( 'aces-style', get_stylesheet_uri() ); wp_enqueue_script( 'aces-navigation', get_template_directory_uri() . '/assets/js/navigation.js', array(), '20151215', true ); wp_enqueue_script( 'aces-skip-link-focus-fix', get_template_directory_uri() . '/assets/js/skip-link-focus-fix.js', array(), '20151215', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } wp_enqueue_script( 'aces-bootstrap-js', get_template_directory_uri() . '/assets/js/bootstrap.min.js', array( 'jquery'), ACES_VERSION, true ); wp_enqueue_script( 'aces-stellarnav-js', get_template_directory_uri() . '/assets/js/stellarnav.js', array( 'jquery'), ACES_VERSION, true ); wp_enqueue_script( 'aces-custom-js', get_template_directory_uri() . '/assets/js/custom.js', array( 'jquery'), ACES_VERSION, true ); if ( class_exists( 'WooCommerce' ) ) { wp_enqueue_style( 'aces-stellarnav', get_template_directory_uri() . '/assets/css/woocommerce.css' ); } } /** * Add a pingback url auto-discovery header for singularly identifiable articles. * * @return void */ public function pingback_header() { if ( is_singular() && pings_open() ) { echo '<link rel="pingback" href="', esc_url( get_bloginfo( 'pingback_url' ) ), '">'; } } /** * Trailing text for post excerpts. * * @return void */ public function excerpt_more( $more ) { if ( is_admin() ) { return $more; } return ''; } /** * Load the required dependencies for this this. * * @return void */ public function load_dependencies() { // Load theme functions require get_template_directory() . '/inc/theme-functions.php'; require get_template_directory() . '/inc/theme-hooks.php'; // Load breadcrumb class require get_template_directory() . '/inc/breadcrumb.php'; /** * Custom template tags for this theme. */ require get_template_directory() . '/inc/template-tags.php'; /** * Customizer additions. */ require get_template_directory() . '/inc/customizer/class-aces-customizer.php'; /** * Load Jetpack compatibility file. */ if ( defined( 'JETPACK__VERSION' ) ) { require get_template_directory() . '/inc/jetpack.php'; } // Load main widget class require get_template_directory() . '/inc/widget/class-aces-widget-init.php'; } /** * Initialize Widgets * * @return void */ public function widget_init() { $aces_widget = new Aces_Widget_Init(); } public static function aces_customizer_custom_css( $output = NULL ) { // Add filter for adding custom css via other functions $output = apply_filters( 'aces_customizer_head_css', $output ); // Minify and output CSS in the wp_head if ( ! empty( $output ) ) { echo "<!-- ACES CSS -->\n<style type=\"text/css\">\n" . wp_strip_all_tags( aces_minify_css( $output ) ) . "\n</style>"; } } }