Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Hopefully a simple answer to this. Using the wp custom header feature, the media upload screen shows an extra field: "set as header". I'm trying to make this text bigger as it can easily be missed.

Firebug says it has a class of "a.wp-set-header". I can change the font size within firebug and it works, but adding this in my css doesn't do anything - any ideas? Thanks

a.wp-set-header{
font-size:22px !important;
font-weight:bold !important;
}
share|improve this question

1 Answer 1

up vote 1 down vote accepted

Its likely that you're not enqueing your CSS file to be used in the admin area, however you did not say. Anyway, this is what you can do...

Place the following into your functions.php file:

add_action( 'admin_print_styles', 'my_admin_css' );
add_action( 'wp_enqueue_scripts', 'my_admin_css' );

function my_admin_css(){
   if( is_admin() ) {
    wp_enqueue_style(
        "media_upload", 
        get_bloginfo('template_directory')."/css/custom_admin.css", 
        false, 
        false, 
        "all"
    );
   }
}

Where ../css/custom_admin.css is an assumed directory and file in your theme folder.

You can learn more about the various methods to handle both scripts and CSS files for both the front end and admin starting with,

http://codex.wordpress.org/Function_Reference/wp_enqueue_style

...the rest of which can be found under the miscellaneous functions section here

http://codex.wordpress.org/Function_Reference#Miscellaneous_Functions

...and you shall see related functions at the bottom of each individual function page like that of the above wp_enqueue_style.

share|improve this answer
    
That worked perfectly - thank you :-) Still don't understand why I have to create a special css sheet and enque it just for this, but I will read your suggested links. –  speedypancake Nov 2 '12 at 10:18
    
The reason is that, the stylesheet that you are using in your theme only gets applied to the front end, not the admin. That's why you need to tell WordPress "Hey I want you to queue up this file on the backend". Which by the way I've made an update to my code, so please adjust yours to reflect this change (using is_admin()). You can use your existing stylesheet in the example if you want but then you would be loading unnecessary styles into your admin area that could conflict. Its always best to separate your styles for logic and best practice purposes regardless of who its for. –  userabuser Nov 2 '12 at 10:23
    
FANTASTIC - Learning so much here, think I'm going to explode! Thanks –  speedypancake Nov 2 '12 at 10:25
    
No problem, the Codex is a great resource to begin with, you can get up to speed on many of the API functions as well as other WP based concepts. Although not the only resource, its a good starting point as a beginner (assuming you are?). Searching WPSE is also an even better idea too, the wealth found in answers here is unparalleled to that of any single site. Any further questions you have along the way - just start a new thread. All the best. –  userabuser Nov 2 '12 at 10:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.