About relationship of Action


Hi Thierry,

I want use another framework. So I added this action in functions.php of child theme.

beans_remove_action ('beans_enqueue_uikit_components');

And I want to use the compression function of less file.

But dose no work this action with "beans_remove_action ('beans_enqueue_uikit_components');"

add_action( 'beans_uikit_enqueue_scripts', 'beans_child_enqueue_uikit_assets' );
function beans_child_enqueue_uikit_assets() {
beans_compiler_add_fragment( 'uikit', get_stylesheet_directory_uri() . '/style.less', 'less' );
}

If "beans_remove_action ('beans_enqueue_uikit_components');" is used in the file of functions.php, will not work action of "beans_uikit_enqueue_scripts" ?

Thanks for read my question. and my english is not good...


Hi M,

The way you are dequeuing UIkit is correct, but the way you are adding your need LESS file isn't πŸ˜‰ In your snippet, you are trying to add a fragment to the uikit compiler, but since you removed it nothing is happening.

Instead, you should create your one compiler as such:

add_action( 'wp_enqueue_scripts', 'example_enqueue' );
/**
 * Example enqueue.
 */
function example_enqueue() {

  beans_compile_less_fragments( 'example', array(
     get_stylesheet_directory_uri() . '/style.less',
        // More files if needed...
    ) );

}

This will create a new compiled file with the ID example. If you then need to add fragments (files) to the compiler in a specific page for example, you may use the same script as your posted but with example handle instead of uikit.

I hope that makes sense, you will find more information in the Compiler API documentation.

Happy coding,


Hi Thierry.

Thanks to your support, this problem has been solved. πŸ™‚

Write a reply

Login or register to write a reply, it's free!