Pergunta

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.

Foi útil?

Solução

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');
Licenciado em: CC-BY-SA com atribuição
Não afiliado a wordpress.stackexchange
scroll top