Question

This is in the template file:

function add_pt_style() {
    wp_enqueue_style ('pt-style', ROOT_PATH.'/pt.css', array(), '1.0.0');
}
add_action( 'wp_enqueue_scripts', 'add_pt_style' );

get_header();

Here are my files:

enter image description here

Here is the error:

enter image description here

I cannot figure out why it's not found.

Était-ce utile?

La solution

I don't think using ROOT_PATH is what you want to do here. That loads the server root.

try this code:

//add some pizazz
function pt_load_plugin_css () {
    
    $plugin_url = plugin_dir_url( __FILE__ );
    wp_enqueue_style ('pt-style', $plugin_url . 'css/pt.css', '1.0.0');
}
add_action ('wp_enqueue_scripts', 'pt_load_plugin_css');
Licencié sous: CC-BY-SA avec attribution
Non affilié à wordpress.stackexchange
scroll top