0

I have to do a wp plugin, it calls a page with a shortcode:

    function shortcode_flexSlide(){
    include ('eleve.php'); 

    }
add_shortcode('flexSlide', 'shortcode_flexSlide');

And now I must load css and js link to the page 'eleve.php'

I have already tried the following:

 wp_enqueue_script( 'flexSlideStyle', plugins_url( '/css/style.css', __FILE__ ));

But it looks at wp root dir + /css/style.css

1 Answer 1

1

If you want to enqueue stylesheet, please use following syntax.

wp_enqueue_style( 'myCSS', plugins_url( '/css/style.css', __FILE__ ) );

Or you can use something like below:

wp_enqueue_style( 'style-name', get_stylesheet_directory_uri(). '/css/style.css' ); // for css
wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true ); // for script, where 1.0.0 is the version

Hope this helps :)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.