at path:
ROOT
/
wp-content
/
plugins
/
qodeblock
/
dist
/
init.php
run:
R
W
Run
assets
DIR
2025-08-15 17:54:33
R
W
Run
getting-started
DIR
2025-08-15 17:54:33
R
W
Run
blocks.build.js
667.3 KB
2025-08-15 17:54:33
R
W
Run
Delete
Rename
blocks.editor.build.css
73.3 KB
2025-08-15 17:54:33
R
W
Run
Delete
Rename
blocks.style.build.css
93.58 KB
2025-08-15 17:54:33
R
W
Run
Delete
Rename
init.php
3.16 KB
2025-08-15 17:54:33
R
W
Run
Delete
Rename
error_log
up
📄
init.php
Save
<?php /** * Blocks Initializer * * Enqueue CSS/JS of all the blocks. * * @since 1.0.0 * @package Qodeblock */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Enqueue assets for frontend and backend * * @since 1.0.0 */ function qodeblock_block_assets() { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Could be true or 'true'. $postfix = ( SCRIPT_DEBUG == true ) ? '' : '.min'; // Load the compiled styles. wp_register_style( 'qodeblock-style-css', plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ), array(), filemtime( plugin_dir_path( __FILE__ ) . 'blocks.style.build.css' ) ); // Load the FontAwesome icon library. wp_enqueue_style( 'qodeblock-fontawesome', plugins_url( 'dist/assets/fontawesome/css/all' . $postfix . '.css', dirname( __FILE__ ) ), array(), filemtime( plugin_dir_path( __FILE__ ) . 'assets/fontawesome/css/all.css' ) ); } add_action( 'init', 'qodeblock_block_assets' ); /** * Enqueue assets for backend editor * * @since 1.0.0 */ function qodeblock_editor_assets() { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Could be true or 'true'. $postfix = ( SCRIPT_DEBUG == true ) ? '' : '.min'; // Load the compiled blocks into the editor. wp_enqueue_script( 'qodeblock-js', plugins_url( '/dist/blocks.build.js', dirname( __FILE__ ) ), array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-components', 'wp-editor' ), filemtime( plugin_dir_path( __FILE__ ) . 'blocks.build.js' ), false ); // Load the compiled styles into the editor. wp_enqueue_style( 'qodeblock-editor-css', plugins_url( 'dist/blocks.editor.build.css', dirname( __FILE__ ) ), array( 'wp-edit-blocks' ), filemtime( plugin_dir_path( __FILE__ ) . 'blocks.editor.build.css' ) ); // Load the FontAwesome icon library. wp_enqueue_style( 'qodeblock-fontawesome', plugins_url( 'dist/assets/fontawesome/css/all' . $postfix . '.css', dirname( __FILE__ ) ), array(), filemtime( plugin_dir_path( __FILE__ ) . 'assets/fontawesome/css/all.css' ) ); // Pass in REST URL. wp_localize_script( 'qodeblock-js', 'qodeblock_globals', array( 'rest_url' => esc_url( rest_url() ), ) ); } add_action( 'enqueue_block_editor_assets', 'qodeblock_editor_assets' ); /** * Enqueue assets for frontend * * @since 1.0.0 */ function qodeblock_frontend_assets() { if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) { return; } // Load the dismissible notice js. wp_enqueue_script( 'qodeblock-dismiss-js', plugins_url( '/dist/assets/js/dismiss.js', dirname( __FILE__ ) ), array( 'jquery' ), filemtime( plugin_dir_path( __FILE__ ) . '/assets/js/dismiss.js' ), true ); } add_action( 'wp_enqueue_scripts', 'qodeblock_frontend_assets' ); add_filter( 'block_categories_all', 'qodeblock_add_custom_block_category' ); /** * Adds the Qodeblock block category. * * @param array $categories Existing block categories. * * @return array Updated block categories. */ function qodeblock_add_custom_block_category( $categories ) { return array_merge( $categories, array( array( 'slug' => 'qodeblock', 'title' => __( 'Qodeblock', 'qodeblock' ), ), ) ); }