Although @Jevuska did solve my issue, I have found a much easier solution to adding dynamic CSS from my theme options page. Here we go!
Add this to functions.php
add_action('wp_head', 'my_custom_css');
function my_custom_css(){
require_once( get_template_directory() . '/css/theme-styles.php' );
}
Now you can treat theme-styles.php as a normal CSS stylesheet
<style type="text/css">
a {
color: <?php echo get_option('some_other_option');?> !important;
}
</style>
Done! It was that simple.
Related Posts:
- Theme Options Page – User Updates Logo
- Selectbox in admin panel function linking to CSS
- Why have on every line
- Function to return true if current page has child pages
- Include a external PHP file into a WordPress Custom Template
- List of all theme customizer control types?
- Get author full name
- How to export/import theme customizer settings?
- How to remove hardcoded characters from playlists?
- reason of splitting theme files to multiple files
- is there a simple way to list every templates / php files used to generate a specific page?
- wp_customize_image_control default value
- Set the transport of the Customizer ‘header_image’ core setting to ‘postMessage’
- WordPress loop specific thumbnail size
- Is it possible to use the featured image of a page as a css background without inlining?
- Widgets not showing in my custom theme
- Why WordPress architecture is not pure object oriented and it don’t use MVC pattern? [closed]
- max_input_vars: how many am I using?
- Set WordPress Default Template
- Customizer: Output default value in Customizer CSS
- Set the checkbox as checked by default at options page
- Create another “Display Site Title and Tagline” checkbox, “Header Text Color” setting and control
- Converting HTML Template to WordPress Theme
- How to use my style.css file outside of wordpress subdomain?
- Can I install/embed WordPress on a ‘single page’?
- Using if/else statements with output from theme options
- Customizer: active_callback and sanitize_callback incompatibility?
- Customize position of social icons in upme plugin [closed]
- Menu jumping when calling it via PHP
- Compare the old get_theme_mod($name) to the new get_theme_mod($name) return value
- How do I add a custom css to all posts without affecting homepage css? [closed]
- Redirect to another page using contact form 7? [closed]
- Custom Background by Page IDs
- How to obtain the current website URL in my theme?
- What exactly do this function declared into functions.php file of a WP theme?
- Underscore – Self hosted fonts
- What file have I to create in my custom WordPress theme to show all the post belonging to a specific category?
- Warning: Illegal string offset on theme options page [closed]
- Why is an array created in a function hooked to customize register populated when customizer is loaded but not when the front-end is loaded?
- Clickable image link sends people to wrong URL
- How to add drag and drop functionalities to a div inside option panel
- How to modify mobile nav menu text in theme
- jQuery accordion menu
- Is there a hack for using is_page() within the function.php file?
- Assign Custom classes to every Excerpt
- pass html code to worpdress
- Using theme options to change a border-radius value
- Displaying images outside the content
- Dynamically switch file in get_template_directory_uri() | Function [closed]
- Create Columns with Custom Walker and CSS Classes
- Problem with displaying CSS Stylesheets – Am I adding them correctly in my wordpress child theme?
- How to print all the inline styles in the WP_Styles instance together with their keys?
- register dependency css and js inside a plugin class
- Fix hover images blink
- custom field – changing an element or background of id div – different versions not working
- CSS loading as empty file in Custom Theme
- How to add Open/Close Toggle button into Twenty Fifteen theme for hiding left sidebar?
- How to get php file based on URL in WordPress
- How can I customize a WordPress theme before it’s downloaded?
- Where can I find the declaration of `$_wp_theme_features`?
- Click to expand menu
- Relative post date in recent posts list
- Display tab title as ‘blog tagline | blog title’
- A Customizer checkbox control that sets the setting to “” or to “blank” and show() or hide() a color control
- My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
- wp_customize_image_control default value
- WordPress causing all code to be displayed on line 1. Receiving multiple errors after cleaning cookies and cache
- How to add button to top of theme customizer?
- Not able to call class in NHP framework
- Sidebar doesnt get updated?
- How to change a specific character in a theme option value – replace a space with a plus sign
- Add CSS class to PHP Statement
- Select area and checkbox data is not saving?
- Load slideshow.css file only if Slideshow is checked / on
- Predefine Magazine Style Layouts
- hello can you advise how to fix the error?
- Passing array in add_option()
- Theme Options: If There is No Input, Don’t Display?
- An unwanted inline style is added to my body tag
- How to load a template-part based on a url wildcard?
- Changing layout with wp_customise
- Customize Theme comment template to Insert VoteUp and VoteDown buttons
- filter default query to show just selected level of child pages in wordpress
- I’m trying to create an array with a foreach loop, but the array only stores the last item [closed]
- Styling the second sidebar
- Theme not calling Jquery properly
- Output only links using wp_nav_menu()
- WordPress redirects page query parameter in URL
- Background image no longer fits to screen now that project is in php files
- I have a background-image in css file but don’t show in site.how to fix this prblm. i sent screenshot. thx
- I cannot find the wordpress.scss file that my live site is pulling from
- Woocommerce variable products are being added to the card on the homepage (ajax)
- user update profile for custom code
- Why isn’t my custom Javascript showing up in my custom template?
- Image not displayed
- Show contact 7 form in popup
- wp_head makes my custom page template not work in Customizer?
- Woocommerce linking variations
- Header location [closed]
- Blog listing not showing dates for every post and arrow missing off image