One way of doing this would be to create a “CSS” file from PHP. In other words, create a file, call it something like style.css.php
, and at the beginning of the file put:
<?php header("Content-type: text/css");
Then, link that file in the head of your theme file. Because the style.css.php
file is a PHP file, anything you can do in a normal PHP file can be done in this file. As such, you can pull theme option values from the database and use them. For example:
#header{
background: <?php echo get_option('my-header-background-color'); ?>
}
Of course, you need to get the options into the database first, but since your question didn’t address that, I won’t go into it here.
Related Posts:
- Using PHP to toggle stylesheet and header image, set in cookie
- Shortcode content output but not in correct place
- Hide Hamburger Menu On Specific Page (Front Page/Home Page)
- How to style options page in dashboard?
- Css loads very slow [closed]
- responsive.css in the WordPress should be prioritized
- height should be set to auto to avoid pixelation in the post thumbnail function
- How to make container class in PHP
- Creating a mobile site by adding a new class to the body tag from functions.php
- CSS change in woo commerce Place Order Text [closed]
- Problem with adding custom CSS class to image in ACF Photo Gallery plugin [closed]
- how to changes mobile menu toggle breakpoint in WordPress
- PHP function for horizontal Woocommerce thumbnails and badges
- Problem with displaying CSS Stylesheets – Am I adding them correctly in my wordpress child theme?
- I got big white screen when i attach main style sheet of Html in functions.php
- Site title not showing. Please help me
- PHP/CSS: Shortcode won’t display correctly, and only displays in the head (before content)
- Add class for the_post_thumbnail_caption()
- Displaying POST content with HTML tags and all
- Highlight Single Page Ancestor
- Styling admin page rows in order of importance (checkboxes)
- How to have Function of a plugin using global vars into a shortcode?
- Cant get theme to change footer color through theme customizer
- How to add margin underneath woocommerce total price amount -> productpages
- How do I get Roboto Google Font to display normal font-style? [closed]
- Integrating CSS Into a WP Function Call [closed]
- Load slideshow.css file only if Slideshow is checked / on
- Sorting Problem
- Displaying Logged-In User Name in WordPress Menu
- Set media upload attachment link to none and hide it in WP v3.5
- One button to change all settings in theme customizer?
- Add custom image sizes to media uploader
- Add/echo div with Analytics-Code to function in functions.php
- How do I list the_tags() into HTML data-attribute
- WordPress if (is_page) translation on certain page
- Highlight Current Tag in wp_tag_cloud
- Getting rid of role=”navigation” in the Home Page Pagination
- How to use return in my custom function instead of echo
- How can I hide Home in my menu in a specific page?
- Trigger popup in a php if/else statement
- Setting a cookie upon specific URL visit
- get post based on category chosen in drop down – The ajax method
- how to make separate field in wordpress user_data_
- Set the background to a default image if there isn’t a specified “featured image”
- WordPress Access allowed to fewer pages till user logs in
- Use DOMDocument with ob_start breaks my HTML code
- different id for same element visual composer [closed]
- Tax query in pre_get_posts not working
- trigger html cleanup for all posts
- Validation algorithm in checkout field
- Illegal string offset in PHP function
- How to remove ?p= from wordpress short links
- Displaying text if post was within 5 hours
- Change “No Comments” link to “My String” on Blog Post (Find Snippet in Code or use CSS, PHP Solution) [closed]
- Adding a tag_ID column into Categories inside the admin dashboard?
- How to make function appear in sentence?
- How to define a variable already defined in a plugin function?
- woocommerce specific quantities for product
- My website is not showing Footer section
- Custom query vars filters problem with pagination
- Menu Custom Data Attributes
- How to modify mobile nav menu text in theme
- Dividing the loop to style post differently
- Use SCSSPHP to compile Theme Customizer Values into .SCSS files ready to compile to CSS
- Must filter functions receive all arguments passed to them?
- How to Display a List of Child Pages For a Parent Page in WordPress
- Displaying Slider in Front Page (home) using Customizr Theme
- How to add PHP pagination to wordpress
- Taxonomy term description with style, only if the description exists?
- Restrict post to current user in postmeta
- How to sort posts by active category in WordPress?
- How to change the author box selection on a post to a custom taxonomy
- How to send a php var to jQuery Ajax call with two different file
- WordPress custom php script to match standard page layout
- copy fields value to another field
- not outputting medium size image URL
- posts_per_page displays only 2 posts instead of 4 posts
- Get parent category name when only child category is applied to a product
- Help me I cannot link my font-awesome to my WordPress Theme. I have my font-awesome folder already in my project
- Google CSE Malfunctions via Chrome/Safari on Mobile When Clicking on Either Search Icon/Menu Icon. How to Make Google CSE Default Theme Search
- Can an AJAX callback function access a PHP variable which was defined during initial page load?
- How to locate parent theme functions and add functions to my wordpress child theme?
- Adding product permalink on admin order page throwing error
- Before & After Content – After Content directly below Before Content when using require_once
- How to call WordPress PHP file using external js file
- How fix error in the WordPress loop?
- use system script advertising in wordpress multisite
- Use WP_Query Data In Cookie
- Extend the WP_Customize_Image_Control class to change its non-frame $button_labels
- Insert wordpress tags below posts via functions.php
- Help with my first Metabox helper class
- ISOTOPE – Missing/Invalid Arguement Get Terms
- Showing all post from all post type in admin backstage
- Pagination not displaying
- Setting WooCommerce currency programmatically
- Masking external links with internal link for member-only
- Understanding responsive imagery
- How to get meta box labels?
- How to create different templates for woocommerce single-product.php?
- Tags being Inserted in html from plugin PHP not passing through the_content