get('Version'); // Register and enqueue styles wp_register_style( 'blynex-block-styles', get_template_directory_uri() . '/build/style-index.css', [], $theme_version ); wp_enqueue_style('blynex-block-styles'); // Load frontend image filter script on frontend if (! is_admin()) { wp_register_script( 'blynex-image-filter-frontend', get_template_directory_uri() . '/assets/js/image-filter-frontend.js', array(), $theme_version, true ); wp_enqueue_script('blynex-image-filter-frontend'); return; } // Load editor scripts (admin only) $asset_path = get_template_directory() . '/build/index.asset.php'; if (file_exists($asset_path)) { $asset_data = require $asset_path; // Register helper script with WordPress dependencies wp_register_script( 'blynex-helper-script', get_template_directory_uri() . '/assets/js/helper.js', array('wp-dom-ready', 'wp-blocks'), $theme_version, true ); // Register main editor script wp_register_script( 'blynex-block-editor-script', get_template_directory_uri() . '/build/index.js', $asset_data['dependencies'], $asset_data['version'], true ); // Enqueue scripts wp_enqueue_script('blynex-helper-script'); wp_enqueue_script('blynex-block-editor-script'); } } /** * Enqueue block editor assets * * Specifically loads assets for the block editor. */ public function enqueue_block_editor_assets() { // Get theme version for cache busting $theme_version = wp_get_theme()->get('Version'); // Load editor scripts $asset_path = get_template_directory() . '/build/index.asset.php'; if (file_exists($asset_path)) { $asset_data = require $asset_path; // Register main editor script wp_register_script( 'blynex-block-editor-script', get_template_directory_uri() . '/build/index.js', $asset_data['dependencies'], $asset_data['version'], true ); // Enqueue the script wp_enqueue_script('blynex-block-editor-script'); } } } // Initialize the class new Blynex_Block_Assets(); }