Puck Puck - 1 year ago 75
CSS Question

wp_enqueue_style Does Not Behave As Documented

I have the following written in a driver:

add_action( 'wp_enqueue_scripts', 'add_css_file' );
function add_css_file()
// Tried this prior:
// $path = ABSPATH . "/wp-content/plugins/this_plugin/css/";
// wp_register_style( 'css_file', $path.'css_file.css' );

wp_register_style( 'css_file', 'http://subdomain.mysite.com/wp-content/plugins/this_plugin/css/css_file.css' );
wp_enqueue_style( 'css_file' );

The string "css_file" does not appear in the View Source HTML and the CSS rules defined therein do not take effect.

Answer Source

The problem for me lay in the fact that I am modifying the Admin screen rather than the display of a Page or Post to viewers.





Best of luck.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download