Hi I'm using the standard way to load styles and scripts within my plugin. But I have no clue why it's not working. It's not shown in the network tab nor in the <head>
. Can this cause issues when overriding templates?
add_action('wp_enqueue_scripts', 'add_styles_scripts');
add_action('admin_enqueue_scripts', 'add_styles_scripts');
function add_styles_scripts()
wp_enqueue_style('rs_css', plugin_dir_url(__FILE__) . 'style/default.css', array());
wp_enqueue_style('rs_fullscreen_css', plugin_dir_url(__FILE__) . 'style/fullscreen.css', array());
wp_enqueue_script('rs_js', plugin_dir_url(__FILE__) . 'style/default.js', array('jquery'));
wp_localize_script('rs_js', 'wordpress_data', array('ajax_url' => admin_url('admin-ajax.php')));
}
add_filter( 'template_include', 'render_custom_template' );
function render_custom_template( $template )
{
add_styles_scripts();
add_styles_scripts
function runs via the error log breakpoints or awp_die
? Is the file this code is in also the root plugin file with the plugin header comment at the top? Or is it a different file? What does the rest ofrender_custom_template
contain, and are you calling the necessary functions in that template such aswp_head()
etc?template_include
wouldn't cause this, it's more likely to be a problem with running the code to enqueue, getting the right file enqueued, or not calling the necessary mandatory functions in the template ( aka WP knows what to enqueue but never has the opportunity to do it )