=' ) ) { wp_enqueue_script_module( 'basicwp-theme', $theme_uri . $js_path, array(), $version, [ 'in_footer' => true ] ); wp_enqueue_script_module( 'basicwp-button', $theme_uri . '/static/js/components/button.js', array( 'basicwp-theme' ), $version, [ 'in_footer' => true ] ); } else { wp_enqueue_script_module( 'basicwp-theme', $theme_uri . $js_path, array(), $version, true ); wp_enqueue_script_module( 'basicwp-button', $theme_uri . '/static/js/components/button.js', array( 'basicwp-theme' ), $version, true ); } } } /** * Enqueue backend (admin/editor) CSS and JS files. */ public function enqBEAssets() { $theme_dir = get_stylesheet_directory(); $theme_uri = get_stylesheet_directory_uri(); /** * Editor CSS */ $editor_css_path = '/styles/backend/editor.css'; if ( file_exists( $theme_dir . $editor_css_path ) ) { $version = filemtime( $theme_dir . $editor_css_path ); wp_enqueue_style( 'basicwp-editor', $theme_uri . $editor_css_path, array(), $version ); } $font_ver = gmdate( 'U' ); wp_enqueue_style( 'raleway', 'https://fonts.googleapis.com/css2?family=Raleway:wght@100..900&display=swap', false, $font_ver ); /** * Admin CSS */ $admin_css_path = '/styles/backend/admin.css'; if ( file_exists( $theme_dir . $admin_css_path ) ) { $version = filemtime( $theme_dir . $admin_css_path ); wp_enqueue_style( 'basicwp-admin', $theme_uri . $admin_css_path, array(), $version ); } /** * Admin JS */ $admin_js_path = '/static/js/admin.js'; if ( file_exists( $theme_dir . $admin_js_path ) ) { $version = filemtime( $theme_dir . $admin_js_path ); wp_enqueue_script( 'jquery' ); // Needed by downstream scripts; modules can't depend on classic scripts. if ( version_compare( get_bloginfo('version'), '6.9', '>=' ) ) { wp_enqueue_script_module( 'basicwp-admin', $theme_uri . $admin_js_path, array(), $version, [ 'in_footer' => true ] ); wp_enqueue_script_module( 'basicwp-button', $theme_uri . '/static/js/components/button.js', array( 'basicwp-admin' ), $version, [ 'in_footer' => true ] ); } else { wp_enqueue_script_module( 'basicwp-admin', $theme_uri . $admin_js_path, array(), $version, true ); wp_enqueue_script_module( 'basicwp-button', $theme_uri . '/static/js/components/button.js', array( 'basicwp-admin' ), $version, true ); } } } } // Initialize the Enqueue class. $enqueue = new Enqueue();