Skip to main content
added 213 characters in body
Source Link
Talon
  • 291
  • 1
  • 4
  • 15

I'm trying to add some CSS to the head part of the CSS but I can't get it to work (I want to add it to the head before the Theme CSS so the plugin user can easily over-ride plugins default CSS without !important over-rides). Here is what I tried:

<?php 
add_action('wp_head', 'addCSS');
function addCSS() {
    wp_register_style( 'prefix-style', plugins_url('AddToCartStyles.css', __FILE__) );
    wp_enqueue_style( 'prefix-style' );
}
?>

EDIT: Maybe the way I worded this was confusing. I Don't want to include the CSS in the plugin Admin Page, I want to include the CSS in the regular theme pages (e.g. the pages the end user will actually see).

I'm trying to add some CSS to the head part of the CSS but I can't get it to work (I want to add it to the head before the Theme CSS so the plugin user can easily over-ride plugins default CSS without !important over-rides). Here is what I tried:

<?php 
add_action('wp_head', 'addCSS');
function addCSS() {
    wp_register_style( 'prefix-style', plugins_url('AddToCartStyles.css', __FILE__) );
    wp_enqueue_style( 'prefix-style' );
}
?>

I'm trying to add some CSS to the head part of the CSS but I can't get it to work (I want to add it to the head before the Theme CSS so the plugin user can easily over-ride plugins default CSS without !important over-rides). Here is what I tried:

<?php 
add_action('wp_head', 'addCSS');
function addCSS() {
    wp_register_style( 'prefix-style', plugins_url('AddToCartStyles.css', __FILE__) );
    wp_enqueue_style( 'prefix-style' );
}
?>

EDIT: Maybe the way I worded this was confusing. I Don't want to include the CSS in the plugin Admin Page, I want to include the CSS in the regular theme pages (e.g. the pages the end user will actually see).

Source Link
Talon
  • 291
  • 1
  • 4
  • 15

Can't get CSS Into the Head via add_action

I'm trying to add some CSS to the head part of the CSS but I can't get it to work (I want to add it to the head before the Theme CSS so the plugin user can easily over-ride plugins default CSS without !important over-rides). Here is what I tried:

<?php 
add_action('wp_head', 'addCSS');
function addCSS() {
    wp_register_style( 'prefix-style', plugins_url('AddToCartStyles.css', __FILE__) );
    wp_enqueue_style( 'prefix-style' );
}
?>