get('Version') ); } } /*----------------------------------------------------- * Define Default Constants *----------------------------------------------------*/ define( 'BORAX_THEMEROOT', get_theme_file_uri()); define( 'BORAX_THEMEROOT_DIR', get_parent_theme_file_path()); define( 'BORAX_IMAGES', BORAX_THEMEROOT . '/assets/images'); define( 'BORAX_IMAGES_DIR', BORAX_THEMEROOT_DIR . '/assets/images'); define( 'BORAX_CSS', BORAX_THEMEROOT . '/assets/css'); define( 'BORAX_CSS_DIR', BORAX_THEMEROOT_DIR . '/assets/css'); define( 'BORAX_SCRIPTS', BORAX_THEMEROOT . '/assets/js'); define( 'BORAX_SCRIPTS_DIR', BORAX_THEMEROOT_DIR . '/assets/js'); define( 'BORAX_INC', BORAX_THEMEROOT_DIR . '/inc'); define( 'BORAX_CUSTOMIZER_DIR', BORAX_INC . '/customizer/'); if ( ! function_exists( 'borax_setup' ) ) : /** * 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 borax_setup() { /* * Make theme available for translation. * Translations can be filed in the /languages/ directory. * If you're building a theme based on Borax, use a find and replace * to change 'borax' to the name of your theme in all the template files. */ load_theme_textdomain( 'borax', 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( 'primary' => esc_html__( 'Primary', 'borax' ), 'footer-menu' => esc_html__( 'Footer Menu', 'borax' ), ) ); /** * Add support for post formats. */ add_theme_support('post-formats', array('standard', 'gallery', 'video', 'audio', 'quote', 'link') ); /* * 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', 'style', 'script', ) ); /** * Add support for core custom background. * * @link https://codex.wordpress.org/Custom_Backgrounds */ $borax_defaults_custom_background = array( 'default-color' => '', 'default-image' => '', 'default-repeat' => 'repeat', 'default-position-x' => 'left', 'default-position-y' => 'top', 'default-size' => 'auto', 'default-attachment' => 'scroll', 'wp-head-callback' => '_custom_background_cb', 'admin-head-callback' => '', 'admin-preview-callback' => '' ); add_theme_support( 'custom-background', $borax_defaults_custom_background ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); /** * Image size names. * */ add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 300, 300, true ); if ( get_theme_mod( 'blog_single_image', 'default' ) == 'custom' ) { $sizes = get_theme_mod( 'blog_single_image_set' ); add_image_size( 'borax-single', absint( $sizes['width'] ), absint( $sizes['height'] ), true ); } else { add_image_size( 'borax-single', 1140, 641, true ); } if ( get_theme_mod( 'blog_archive_image', 'default' ) == 'custom' ) { $size = get_theme_mod( 'blog_archive_image_set' ); add_image_size( 'borax-med', absint( $size['width'] ), absint( $size['height'] ), true ); } else { add_image_size( 'borax-med', 720, 405, true ); } add_image_size( 'borax-thumbnail', 160, 120, true ); /** * 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 editor style * * @link https://developer.wordpress.org/reference/functions/add_editor_style/ */ add_editor_style('assets/css/editor-style.css'); /** * Add support for core custom Header. * * @link https://developer.wordpress.org/themes/functionality/custom-headers/ */ $borax_custom_header = array( 'default-image' => get_template_directory_uri() . '/assets/images/page-feature.jpg', 'default-text-color' => '000', 'width' => 1000, 'height' => 250, 'flex-width' => true, 'flex-height' => true, ); add_theme_support( 'custom-header', $borax_custom_header ); } endif; add_action( 'after_setup_theme', 'borax_setup' ); /** * Set the content width in pixels, based on the theme's design and stylesheet. * * Priority 0 to make it available to lower priority callbacks. * * @global int $content_width */ function borax_content_width() { // 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( 'borax_content_width', 640 ); } add_action( 'after_setup_theme', 'borax_content_width', 0 ); /** * Enqueue scripts and styles. */ function borax_scripts_unminify() { // Google Fonts wp_enqueue_style( 'lepspa-fonts', borax_google_fonts_url(), null, BORAX_VERSION ); // Bootstrap wp_enqueue_style( 'bootstrap', BORAX_CSS. '/bootstrap.min.css', null, BORAX_VERSION ); // Themify-icon wp_enqueue_style( 'themify-icon', BORAX_CSS. '/themify-icons.css', null, BORAX_VERSION ); // Font awesome wp_enqueue_style( 'font-awesome-all', BORAX_CSS . '/all.min.css', null, BORAX_VERSION ); // Owl Carousel wp_enqueue_style( 'owl-carousel', BORAX_CSS. '/owl.carousel.min.css', null, BORAX_VERSION ); // Fancybox wp_enqueue_style( 'fancybox', BORAX_CSS. '/jquery.fancybox.min.css', null, BORAX_VERSION ); // Twentytwenty wp_enqueue_style( 'twentytwenty', BORAX_CSS. '/twentytwenty.css', null, BORAX_VERSION ); // borax-icon wp_enqueue_style( 'borax-icon', BORAX_CSS. '/borax-icon.css', null, BORAX_VERSION ); // Gutenberg Custom wp_enqueue_style( 'gutenberg-custom', BORAX_CSS. '/gutenberg-custom.css', null, BORAX_VERSION ); // Borax Main wp_enqueue_style( 'borax-main', BORAX_CSS. '/borax-main.css', null, BORAX_VERSION ); // Main Stylesheet wp_enqueue_style( 'style', get_stylesheet_uri(), array(), BORAX_VERSION ); /** * Borax all script include */ // Borax Navication wp_enqueue_script( 'borax-navigation', BORAX_SCRIPTS . '/navigation.js', array('jquery'), BORAX_VERSION, true ); // Countdown wp_enqueue_script( 'countdown', BORAX_SCRIPTS . '/jquery.countdown.min.js', array('jquery'), BORAX_VERSION, true ); // bootstrap wp_enqueue_script( 'bootstrap', BORAX_SCRIPTS . '/bootstrap.min.js', array('jquery'), BORAX_VERSION, true ); // Owl carousel wp_enqueue_script( 'owl-carousel', BORAX_SCRIPTS . '/owl.carousel.min.js', array('jquery'), BORAX_VERSION, true ); // Owl thumbs wp_enqueue_script( 'owl-thumbs', BORAX_SCRIPTS . '/owl.carousel2.thumbs.min.js', array('jquery'), BORAX_VERSION, true ); // Tilt js wp_enqueue_script( 'tilt-jquery', BORAX_SCRIPTS . '/tilt.jquery.js', array('jquery'), BORAX_VERSION, true ); // Fancybox wp_enqueue_script( 'fancybox', BORAX_SCRIPTS . '/jquery.fancybox.min.js', array('jquery'), BORAX_VERSION, true ); // Twentytwenty wp_enqueue_script( 'twentytwenty', BORAX_SCRIPTS . '/jquery.twentytwenty.js', array('jquery'), BORAX_VERSION, true ); // Event-move wp_enqueue_script( 'event-move', BORAX_SCRIPTS . '/jquery.event.move.js', array('jquery'), BORAX_VERSION, true ); // Onscreeen wp_enqueue_script( 'onscreeen', BORAX_SCRIPTS . '/onscreeen.js', array('jquery'), BORAX_VERSION, true ); // Isotope wp_enqueue_script( 'Isotope', BORAX_SCRIPTS . '/isotope.pkgd.min.js', array('jquery'), BORAX_VERSION, true ); // GSAP wp_enqueue_script( 'gsap', BORAX_SCRIPTS . '/gsap.min.js', array('jquery'), BORAX_VERSION, true ); // elementor-elements.js wp_enqueue_script( 'elementor-elements', BORAX_SCRIPTS . '/elementor-elements.js', array('jquery'), BORAX_VERSION, true ); // Borax Script wp_enqueue_script( 'borax-script', BORAX_SCRIPTS . '/scripts.js', array('jquery'), BORAX_VERSION, true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } /* Minifyed */ function borax_scripts_minify() { // Google Fonts wp_enqueue_style( 'lepspa-fonts', borax_google_fonts_url(), null, BORAX_VERSION ); wp_enqueue_style( 'borax-minify-css', BORAX_CSS. '/minify-style.css', null, BORAX_VERSION ); // Main Stylesheet wp_enqueue_style( 'style', get_stylesheet_uri(), array(), BORAX_VERSION ); // elementor-elements.js wp_enqueue_script( 'elementor-elements', BORAX_SCRIPTS . '/elementor-elements.js', array('jquery'), BORAX_VERSION, true ); // Borax Script wp_enqueue_script( 'borax-minify-script', BORAX_SCRIPTS . '/minify-scripts.js', array('jquery'), BORAX_VERSION, true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } /** * Custom template tags for this theme. */ require get_template_directory() . '/inc/template-tags.php'; /** * Functions which enhance the theme by hooking into WordPress. */ require get_template_directory() . '/inc/template-functions.php'; /** * Customizer additions. */ require get_template_directory() . '/inc/customizer/customizer-config.php'; /** * Widget additions. */ require get_template_directory() . '/inc/widget.php'; /** * Add Plugins */ require get_template_directory() . '/inc/plugins.php'; /** * Botstrap nav additions. */ require get_template_directory() . '/inc/wp_bootstrap_navwalker.php'; // Custom page walker. require get_template_directory() . '/inc/borax-walker-page.php'; /** * Menu Custom fields */ require get_template_directory() . '/inc/nav-menu-custom-fields.php'; /** * Load Jetpack compatibility file. */ if ( defined( 'JETPACK__VERSION' ) ) { require get_template_directory() . '/inc/jetpack.php'; } $minifyUnminify = borax_option('minifyUnminify'); if($minifyUnminify == true){ add_action( 'wp_enqueue_scripts', 'borax_scripts_minify' ); }else{ add_action( 'wp_enqueue_scripts', 'borax_scripts_unminify' ); }