%1$s %2$s git submodule update --init --recursive

', esc_html__( 'Advanced Heading:', 'advanced-heading' ), esc_html__( 'the lib/style-handler submodule is missing, so block styles cannot be generated on the frontend. Run:', 'advanced-heading' ) ); } ); } unset( $advanced_heading_style_handler ); function create_block_advanced_heading_block_init() { if ( ! defined( 'ADVANCEDHEADING_BLOCK_VERSION' ) ) { define( 'ADVANCEDHEADING_BLOCK_VERSION', "1.2.1" ); } if ( ! defined( 'ADVANCEDHEADING_BLOCK_ADMIN_URL' ) ) { define( 'ADVANCEDHEADING_BLOCK_ADMIN_URL', plugin_dir_url( __FILE__ ) ); } if ( ! defined( 'ADVANCEDHEADING_BLOCK_ADMIN_PATH' ) ) { define( 'ADVANCEDHEADING_BLOCK_ADMIN_PATH', dirname( __FILE__ ) ); } $script_asset_path = ADVANCEDHEADING_BLOCK_ADMIN_PATH . "/dist/index.asset.php"; if ( ! file_exists( $script_asset_path ) ) { throw new Error( 'You need to run `npm start` or `npm run build` for the "block/testimonial" block first.' ); } $index_js = ADVANCEDHEADING_BLOCK_ADMIN_URL . 'dist/index.js'; $script_asset = require $script_asset_path; if ( ! is_array( $script_asset ) ) { $script_asset = []; } $script_asset['dependencies'] = isset( $script_asset['dependencies'] ) && is_array( $script_asset['dependencies'] ) ? $script_asset['dependencies'] : []; $script_asset['version'] = isset( $script_asset['version'] ) ? $script_asset['version'] : ADVANCEDHEADING_BLOCK_VERSION; $all_dependencies = array_merge( $script_asset['dependencies'], [ 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-block-editor', 'advancedheading-block-controls-util', 'essential-blocks-eb-animation' ] ); wp_register_script( 'create-block-advancedheading-block-editor-script', $index_js, $all_dependencies, $script_asset['version'], true ); $load_animation_js = ADVANCEDHEADING_BLOCK_ADMIN_URL . 'lib/resources/js/eb-animation-load.js'; wp_register_script( 'essential-blocks-eb-animation', $load_animation_js, [], ADVANCEDHEADING_BLOCK_VERSION, true ); $fontawesome_css = ADVANCEDHEADING_BLOCK_ADMIN_URL . 'lib/resources/css/font-awesome5.css'; wp_register_style( 'fontawesome-frontend-css', $fontawesome_css, [], ADVANCEDHEADING_BLOCK_VERSION ); wp_register_style( 'fontpicker-default-theme', ADVANCEDHEADING_BLOCK_ADMIN_URL . 'lib/resources/css/fonticonpicker.base-theme.react.css', [], ADVANCEDHEADING_BLOCK_VERSION, 'all' ); wp_register_style( 'fontpicker-material-theme', ADVANCEDHEADING_BLOCK_ADMIN_URL . 'lib/resources/css/fonticonpicker.material-theme.react.css', [], ADVANCEDHEADING_BLOCK_VERSION, 'all' ); $animate_css = ADVANCEDHEADING_BLOCK_ADMIN_URL . 'lib/resources/css/animate.min.css'; wp_register_style( 'essential-blocks-animation', $animate_css, [], ADVANCEDHEADING_BLOCK_VERSION ); $style_css = ADVANCEDHEADING_BLOCK_ADMIN_URL . 'dist/style.css'; //Editor Style wp_register_style( 'create-block-advancedheading-block-editor-style', $style_css, [ 'fontawesome-frontend-css', 'fontpicker-default-theme', 'fontpicker-material-theme', 'essential-blocks-animation' ], ADVANCEDHEADING_BLOCK_VERSION ); //Frontend Style wp_register_style( 'create-block-advancedheading-block-frontend-style', $style_css, [ 'fontawesome-frontend-css', 'essential-blocks-animation' ], ADVANCEDHEADING_BLOCK_VERSION ); // Must match the name in block.json (and the name registered from src/index.js). // Checking a different name here would skip PHP registration while JS still // registers the block, leaving the frontend without its stylesheet. if ( ! WP_Block_Type_Registry::get_instance()->is_registered( 'advanced-heading/advanced-heading' ) ) { register_block_type( Advanced_Heading_Helper::get_block_register_path( "advanced-heading/advanced-heading", ADVANCEDHEADING_BLOCK_ADMIN_PATH ), [ 'editor_script' => 'create-block-advancedheading-block-editor-script', 'editor_style' => 'create-block-advancedheading-block-editor-style', 'render_callback' => function ( $attributes, $content, $block = null ) { if ( ! is_admin() ) { wp_enqueue_style( 'create-block-advancedheading-block-frontend-style' ); // The separator icon can be a Dashicon, and core does not load // dashicons on the frontend for logged-out visitors. wp_enqueue_style( 'dashicons' ); wp_enqueue_script( 'essential-blocks-eb-animation' ); } // "Dynamic Title" headings (latest design only) save no markup. if ( is_array( $attributes ) && isset( $attributes['source'], $attributes['designVersion'] ) && 'dynamic-title' === $attributes['source'] && (int) $attributes['designVersion'] >= 2 ) { return advanced_heading_render_dynamic_title( $attributes, $block ); } return $content; } ] ); } } add_action( 'init', 'create_block_advanced_heading_block_init', 99 );