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
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 :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.