3 changed files with 69 additions and 24 deletions
@ -0,0 +1,31 @@ |
|||
<?php |
|||
|
|||
use Core\Global_Functions; |
|||
|
|||
class <%= blockClassModel %>_Component { |
|||
|
|||
public function __construct() { |
|||
add_action( 'wp_enqueue_scripts', [ $this, 'register_assets' ] ); |
|||
} |
|||
|
|||
function register_assets(): void { |
|||
wp_enqueue_style( '<%= blockFilename %>', |
|||
get_template_directory_uri() . '/components/partials/<%= blockFilename %>/templates/styles/<%= blockFilename %>.min.css', |
|||
[ 'style-wp' ], |
|||
Global_Functions::get_current_version_number() |
|||
); |
|||
|
|||
wp_enqueue_script( '<%= blockFilename %>', |
|||
get_template_directory_uri() . '/components/partials/<%= blockFilename %>/templates/scripts/<%= blockFilename %>.min.js', |
|||
[ 'jquery', 'swiper' ], |
|||
Global_Functions::get_current_version_number(), |
|||
true |
|||
); |
|||
} |
|||
|
|||
public function render( $args = [] ): void { |
|||
$output = ( include( __DIR__ . '/templates/<%= blockFilename %>.template.php' ) )( array_merge( [], $args ), self::class ); |
|||
echo apply_filters( 'the_content', wpautop( $output ) ); |
|||
} |
|||
|
|||
} |
|||
Loading…
Reference in new issue