Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#7048 closed enhancement (wontfix)

Support for style.php in themes

Reported by: dglenny's profile dglenny Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.5.1
Component: Template Keywords:
Focuses: Cc:


Themes for Wordpress must have a stylesheet file called "style.css" as their main file. I like to use PHP files for stylesheets, as it allows you to centralise colours and other nice things.

I work around this Wordpress design at present by altering the theme.php file, specifically:

$stylesheet_uri = $stylesheet_dir_uri . "/style.php";

Note that I still have to keep a style.css file around in the theme folder with the theme information.

It would be ideal if the engine either supported stylesheet name definition within a theme or included both .css and .php by default.

Change History (3)

#1 @Viper007Bond
14 years ago

  • Component changed from General to Template
  • Keywords needs-patch added
  • Version set to 2.5.1

You don't need to alter any core files -- just have your theme load style.php rather than style.css (which can be blank):

<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/style.php" type="text/css" media="screen" />

Although using a .php stylesheet for dynamic content tends to be a bad idea as it's cached by the user's browser meaning any changes won't take effect. I'd suggest either adding a GET variable or even better, just having a master stylesheet (style.css) and then loading an additional stylesheet for the color you want.

I have no opposition though to also checking for style.php, but I don't know if stuff would get broken by it or not.

#2 @strider72
14 years ago

Viper007Bond -- A change would be needed for child themes.

#3 @jacobsantos
14 years ago

  • Keywords needs-patch removed
  • Milestone 2.7 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

There are simple work arounds for achieving this. Doesn't seem to be any real reason, except for, "It would be super sweet." Also, there isn't any patch.

Note: See TracTickets for help on using tickets.