0

I want to add/change the CSS of my current theme from my plugin.

I've tried add_action and wp_enqueue_style and doesn't work

My code:

function register_plugin_styles() {

        wp_enqueue_style( 'fh-plugin' , plugins_url( 'nf-plugin/includes/f-hide.css' ));

    }

    add_action( 'wp_enqueue_scripts', 'register_plugin_styles' );
1
  • Has this question been resolved? Did my answer help? Commented Sep 12, 2016 at 2:10

1 Answer 1

1

I believe you need to add __FILE__ to your plugins_url() function. It may not be calling the right location. It should look like this:

add_action( 'wp_enqueue_scripts', 'wpse_238154_register_plugin_styles' );

function wpse_238154_register_plugin_styles() {
    wp_enqueue_style( 'fh-plugin' , plugins_url( 'nf-plugin/includes/f-hide.css', __FILE__ ) );
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.