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.

When I navigate to...

Appearance > Editor > Edit Themes

The default file that gets loaded there is my options.css file (which I don't want anyone editing since it styles my theme options panel, not the theme itself.)

How can I specify which file gets loaded there? Ideally, I'd like for my theme's current stylesheet to be loaded there. Is there a way that I can specify this in script from functions.php?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Looking at theme-editor.php code it calls get_themes() (fills global $wp_themes variable with themes, including full lists of theme files) and then simply picks first file out of files from current theme.

It jumps to CSS because PHP and CSS files are stored separately and when arrays merge CSS comes on top.

So you can just rename your file so it isn't first in list.

More complex way would be to hook and run get_themes() earlier and then manually rearrange files in $wp_themes. I am not good with admin area, have trouble finding fitting hook to run it conditionally on editor page alone.

share|improve this answer
    
OK, that makes sense. Wish I had more control, but I think I'll just create a dummy css and name it 1.css or abc.css perhaps... –  Scott B Sep 28 '10 at 20:27
    
perhaps this has been changed in the lates builds (WP 3.0+)? Although my file "custom.css" is before "style.css" by alpha, style.css still gets loaded by default when user clicks on "Appearance > Editor" –  Scott B May 9 '11 at 19:12
    
@Scott B yes, this was changed in 3.1 branch, now it will actively try to load style.css and only goes to first file alphabetically if that isn't available. Source. –  Rarst May 9 '11 at 19:24
add comment

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.