Title: Dynamic Stylesheet and get_theme_mod() error
Last modified: August 30, 2016

---

# Dynamic Stylesheet and get_theme_mod() error

 *  [WebTrooper](https://wordpress.org/support/users/webtrooper/)
 * (@webtrooper)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/dynamic-stylesheet-and-get_theme_mod-error/)
 * I’m having an issue while trying to use a dynamic stylesheet, mystyle.css.php,
   getting the error “Fatal error: Call to undefined function get_theme_mod()”
 * I registered and enqueued the the stylesheet in my functions.php file, as follows:
 *     ```
       wp_register_style('mystyle', get_template_directory_uri() . '/bc-parts/mystyle.css.php');
       wp_enqueue_style('mystyle', get_template_directory_uri() . '/bc-parts/mystyle.css.php');
       ```
   
 * And this is the stylesheet:
 *     ```
       <?php
       header('Content-type: text/css');
       ?>
   
       a:link, a:visited:link {
       	color: <?php echo get_theme_mod(site_title_color);?>;
       ```
   
 * I’m using WordPress Customizer with Kirky plugin. My objective is to use a dynamic
   stylesheet rather than having all the generated styles output to the head of 
   the theme.
 * What am I missing?
 * Thanks 🙂

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

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/dynamic-stylesheet-and-get_theme_mod-error/#post-6599535)
 * You can’t directly request custom PHP pages in WP. You’ll see some work arounds
   where the requested page includes wp-load.php, but that is not a truly workable
   solution. This is all explained here:
    [http://glennmessersmith.com/pages/wpenviro.html](http://glennmessersmith.com/pages/wpenviro.html)
 * As it happens, he uses a dynamic CSS file as an example!
 *  Thread Starter [WebTrooper](https://wordpress.org/support/users/webtrooper/)
 * (@webtrooper)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/dynamic-stylesheet-and-get_theme_mod-error/#post-6599571)
 * Thank you, bcworkz. In my search for a solution I did find mentions of wp-load.
   php, and now it makes perfect sense. I realize this is not a perfect solution,
   as it loads way more code than what I need for a simple stylesheet, but now I
   can move forward with my project while I try to find a more efficient solution.
   Have a great day!
 *  [catacaustic](https://wordpress.org/support/users/catacaustic/)
 * (@catacaustic)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/dynamic-stylesheet-and-get_theme_mod-error/#post-6599578)
 * I’d suggest to do it the way that they do it in the codes pages. That’s to add
   in a block of CSS in the `<head>` tags using the `wp_head` action. There’s no
   need for any outside files, no loading more resources than are required (because
   they’re alreayd loaed anyway), and you can easily control where the code is output
   by varying the `$priority` argument.
 *  Thread Starter [WebTrooper](https://wordpress.org/support/users/webtrooper/)
 * (@webtrooper)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/dynamic-stylesheet-and-get_theme_mod-error/#post-6599587)
 * Thanks for the tip, Catacaustic, but that’s exactly what I’m trying to not do.
   The stylesheet is really huge.

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

The topic ‘Dynamic Stylesheet and get_theme_mod() error’ is closed to new replies.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 4 replies
 * 3 participants
 * Last reply from: [WebTrooper](https://wordpress.org/support/users/webtrooper/)
 * Last activity: [10 years, 8 months ago](https://wordpress.org/support/topic/dynamic-stylesheet-and-get_theme_mod-error/#post-6599587)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
