Skip to content

Commit

Permalink
update CSS method
Browse files Browse the repository at this point in the history
  • Loading branch information
mikka23 committed Sep 21, 2020
1 parent 457396b commit 19f6379
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
28 changes: 26 additions & 2 deletions elements/hello-world.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,28 @@ public function add_options() {
* @return void
*/
public function add_scripts() {

/* For example.
Fusion_Dynamic_JS::enqueue_script(
'fusion-date-picker',
FUSION_BUILDER_PLUGIN_URL . 'assets/js/library/flatpickr.js',
FUSION_BUILDER_PLUGIN_URL . 'assets/js/library/flatpickr.js',
[ 'jquery' ],
'1',
true
);
*/
}

/**
* Load element base CSS.
*
* @access public
* @since 3.0
* @return void
*/
public function add_css_files() {
FusionBuilder()->add_element_css( SAMPLE_ADDON_PLUGIN_DIR . 'css/my-elements.css' );
}
}
}
Expand All @@ -189,12 +211,14 @@ public function add_scripts() {
*
* @since 1.0
*/
function hello_world() {
function hello_world_map() {

$fusion_settings = fusion_get_fusion_settings();

fusion_builder_map(
fusion_builder_frontend_data(

// Class reference.
'MyHelloWorld',
[
'name' => esc_attr__( 'Hello World', 'hello-world' ),
Expand Down Expand Up @@ -241,4 +265,4 @@ function hello_world() {
)
);
}
add_action( 'fusion_builder_before_init', 'hello_world' );
add_action( 'fusion_builder_before_init', 'hello_world_map' );
11 changes: 0 additions & 11 deletions fusion-builder-sample-add-on.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,4 @@ function my_init_elements() {
}
add_action( 'fusion_builder_shortcodes_init', 'my_init_elements', 10 );


function my_enqueue_scripts() {
Fusion_Dynamic_CSS::enqueue_style( SAMPLE_ADDON_PLUGIN_DIR . 'css/my-elements.css', SAMPLE_ADDON_PLUGIN_URL . 'css/my-elements.css' );
/*
Using the above call will combined into the compiled CSS. Alternatively you can enqueue separately with:
wp_enqueue_style( 'my-elements', SAMPLE_ADDON_PLUGIN_URL . 'css/my-elements.css', false, false );
In that case also change hook below from wp to wp_enqueue_scripts.
*/
}
add_action( 'wp', 'my_enqueue_scripts', 10 );
}

0 comments on commit 19f6379

Please sign in to comment.