Load custom CSS and JS scripts for single custom post from plugin

function custom_scripts(){
    if( is_single() && get_post_type()=='books' ){
        wp_enqueue_style( 'bootstrap', plugin_dir_url( __FILE__ ) . 'css/bootstrap.min.css' );
        wp_enqueue_script( 'prism', 'https://cdnjs.cloudflare.com/ajax/libs/prism/1.4.1/prism.js');
add_action('wp_enqueue_scripts', 'custom_scripts');
Need a helping hand in fixing your website issues?

If you are facing any problems in implementing these code snippets and tutorials, you can hire us to fix your website issues.

Hire Us