Title: css.php for dynamic content?
Last modified: August 18, 2016

---

# css.php for dynamic content?

 *  [kuma_pageworks](https://wordpress.org/support/users/kuma_pageworks/)
 * (@kuma_pageworks)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/cssphp-for-dynamic-content/)
 * I have a series of background images for the top banner of my blog. I’ve created
   a file, called css.php that poops out the CSS for the page, and includes a switch
   statement to swap out the URL for the banner each time the page is loaded.
 * How do I tell WP to point at the .php file instead of the .css file? Do I need
   to hard-code it into the template? Do I need to go into the database and tinker
   with the bloginfo settings? The .php file will return the text/css header – but
   I have no idea how to point WP to the file.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [viper007bond](https://wordpress.org/support/users/viper007bond/)
 * (@viper007bond)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/cssphp-for-dynamic-content/#post-243303)
 * header.php in your template folder.
 * However, I’d suggest keeping a static CSS file, style.css or whatever, and then
   manually adding in some CSS to the header of your document. Browsers usually 
   cache external style sheets and so your header may not change. Plus, it’ll have
   to re-download the whole style sheet each time, costing bandwidth and load time.
 * Here’s an example:
 * `<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/
   css" media="screen" />`
 * `<style type="text/css" media="screen">`
 * `#headerimage { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/[
   random image filename here]") repeat-x top center fixed; border: none; }`
 * `</style>`
 *  [eragle](https://wordpress.org/support/users/eragle/)
 * (@eragle)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/cssphp-for-dynamic-content/#post-243304)
 * The file does the .css for the whole page? Why not just the logo/header?
 * Does the .css change with every page load or just the logo?
 *  Thread Starter [kuma_pageworks](https://wordpress.org/support/users/kuma_pageworks/)
 * (@kuma_pageworks)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/cssphp-for-dynamic-content/#post-243310)
 * I’m flogging the ‘Connections’ theme that I downloaded from WP. The image URL
   is in the CSS, not the PHP. I put a static link to css.php in index.php (which
   is where it started), and it changes every time you refresh the page.
 * [http://blog.kumapageworks.org](http://blog.kumapageworks.org)
 * I’m sure there are better ways to do it – but it works. I think maybe tomorrow
   I’ll split the CSS files into two imports to save bandwidth.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘css.php for dynamic content?’ is closed to new replies.

## Tags

 * [stylesheet_url](https://wordpress.org/support/topic-tag/stylesheet_url/)

 * 3 replies
 * 3 participants
 * Last reply from: [kuma_pageworks](https://wordpress.org/support/users/kuma_pageworks/)
 * Last activity: [20 years, 10 months ago](https://wordpress.org/support/topic/cssphp-for-dynamic-content/#post-243310)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
