Title: Stylesheet Changes Using Theme Options Page
Last modified: August 19, 2016

---

# Stylesheet Changes Using Theme Options Page

 *  [Equal Web Creative](https://wordpress.org/support/users/equalwebcreative/)
 * (@equalwebcreative)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/stylesheet-changes-using-theme-options-page/)
 * I have a theme options page with stores value in the options table. I am then
   using these values to allow users to customise a stylesheet. The stylesheet is
   loaded in the head of the theme and brings values from the options table.
 * To make the second stylesheet load WordPress function (notably `get_option()`)
   I am using this code in my themes functions.php file:
 *     ```
       <?php
       add_filter('query_vars', 'add_new_var_to_wp');
       function add_new_var_to_wp($public_query_vars) {
           $public_query_vars[] = 'my_theme_custom_var';
           //my_theme_custom_var is the name of the custom query variable that is created and how you reference it in the call to the file
           return $public_query_vars;
       }
       add_action('template_redirect', 'my_theme_css_display');
       function my_theme_css_display(){
           $css = get_query_var('my_theme_custom_var');
           if ($css == 'css'){
               include_once (TEMPLATEPATH . '/style-options.php');
               exit;  //This stops WP from loading any further
           }
       }
       ?>
       ```
   
 * I then call the stylesheet in the head of header.php below the themes stylesheet
   using this:
 * `<link rel="stylesheet" href="<?php bloginfo('url'); ?>/?my_theme_custom_var=
   css" type="text/css" media="screen" />`
 * It all works fine, but it seems to load the additional stylesheet (style-options.
   php) twice rather than once. Anyone any ideas?
 * Thanks in advance for your time.

The topic ‘Stylesheet Changes Using Theme Options Page’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [Equal Web Creative](https://wordpress.org/support/users/equalwebcreative/)
 * Last activity: [15 years, 11 months ago](https://wordpress.org/support/topic/stylesheet-changes-using-theme-options-page/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
