// register jquery and style on initialization
add_action('init', 'register_script');
function register_script() {
wp_register_style( 'bootstrap', plugins_url('/bootstrap/css/bootstrap.css', __FILE__));
}
// use the registered jquery and style above
add_action('wp_enqueue_scripts', 'enqueue_style');
function enqueue_style(){
wp_enqueue_style( 'bootstrap' );
}
my folder’s name is turnover-calculator it only have the bootrap folder and turnovercalculator.php
i tried to call the btn class to try if it’s working but it’s still not working.
2
Answers
You have to use the right hooks,
wp_register_style
andwp_enqueue_style
can only be called insidewp_enqueue_scripts
hook.please use this code:
You can just enqueue the style directly inside the
wp_enqueue_scripts
callback like this: