Stylesheets can hold only CSS.
If you make use of the body_class() function, then you get classes for nearly every request. You can then define those classes (ex. backgrounds) inside your stylesheet.
Add this inside your templates: <body <?php body_class(); ?>> (if you haven’t already got it).
Related Posts:
- How to target with css, admin elements according to user role level?
- “wp_enqueue_style();” don’t load new edited style
- Best way of adding CSS which can be manipulated by the user via theme option panels?
- Need help on WordPress and php
- Multiple pages on one with different HTML
- WordPress Customizer not setting default value upon initial install?
- wp_enqueue_style with style.php and WordPress functions
- Minify HTML, CSS, JS with PHPWee?
- Archive dropdown styling not applied
- Different background-image by category
- Add a Different CSS Class Into The Body Tag of Different WP Pages
- WordPress override bloginfo variable
- Shortcode content output but not in correct place
- Displaying theme options in css
- Show post in slider
- Add a custom stylesheet for BlackBerry
- How can I hide Home in my menu in a specific page?
- Hide Hamburger Menu On Specific Page (Front Page/Home Page)
- how to remove metadata from the posts of my blog?
- Is there CSS to expand the gallery limit on Index Pages?
- How to add condition in wordpress loop? [closed]
- Css loads very slow [closed]
- Different post styles depending on category
- How create a Shortcode with hover and complex options
- WordPress Multiple Navigation bars
- two columns of posts on homepage, one of them “favorites”
- custom css for admin only
- responsive.css in the WordPress should be prioritized
- Custom Background by Page IDs
- WordPress style.css not updating, only after theme reload
- Adding logo to WordPress header
- Thumbnails appear to be zoomed
- Change CSS based on is_user_logged_in
- Styling the second sidebar
- How to add drag and drop functionalities to a div inside option panel
- Change “No Comments” link to “My String” on Blog Post (Find Snippet in Code or use CSS, PHP Solution) [closed]
- Menu Custom Data Attributes
- Highlight the links without using dropdown
- Add New Text Box To WordPress Twenty Seventeen Header
- How to modify mobile nav menu text in theme
- Need help removing […] after excerpt
- Dividing the loop to style post differently
- jQuery accordion menu
- Twentyfifteen style author comment
- Extend Menu Walker Output
- conditional: if is page, and all subpages
- wp nav menu: show submenu below li item
- Styling an “active” link outside of WordPress default menu
- I get “Cannot modify header information – headers already sent” when I change my theme
- How to edit background color of only one sidebar?
- How to sort posts by active category in WordPress?
- Background image no longer fits to screen now that project is in php files
- Add css class to string
- Removing links from Grouped products
- How to make only the valid active page of a multilevel menu active with – “.nav li.current-menu-item a”?
- WordPress custom php script to match standard page layout
- I can’t go to the page archive-{post_type}.php
- Problem with displaying CSS Stylesheets – Am I adding them correctly in my wordpress child theme?
- admin panel – How to remove “delete” button from category editing page
- I have a background-image in css file but don’t show in site.how to fix this prblm. i sent screenshot. thx
- Help me I cannot link my font-awesome to my WordPress Theme. I have my font-awesome folder already in my project
- I cannot find the wordpress.scss file that my live site is pulling from
- Google CSE Malfunctions via Chrome/Safari on Mobile When Clicking on Either Search Icon/Menu Icon. How to Make Google CSE Default Theme Search
- I have a lot of JavaScript erorrs after SSL someone can help me?
- register dependency css and js inside a plugin class
- Hide author from search results meta, still display date and categories
- How to locate parent theme functions and add functions to my wordpress child theme?
- Make a full-width wordpress page
- custom field – changing an element or background of id div – different versions not working
- How to display post_content from database in different on template page?
- remove blank space where sidebar was
- user update profile for custom code
- Display specific main Sub Nav on Woocommerce product pages
- Clone the “proceed to cart” button and place it above checkout on the cart page, but only appear display size is 320px
- Highlight Single Page Ancestor
- Widget edit and add in any page
- Styling admin page rows in order of importance (checkboxes)
- Why isn’t my link attribute getting my css?
- How to save the output of php variables used in inline css code to the main style.css?
- Show contact 7 form in popup
- featured post as div background
- Combining fancybox with multiple thumbnail plugin
- Trying to customize wordpress drop down categories
- Show Nav Link To Users Signed In
- Converting Menu Links to List Elements
- PHP Puzzle: Unique Styles with PHP loop
- How to use plugins_url() inside PHP stylesheet file [duplicate]
- How to get shared CSS body class between translated WPML pages [closed]
- How to customize posts in WordPress by using HTML and CSS?
- WP_Query not returning results
- Header location [closed]
- Blog listing not showing dates for every post and arrow missing off image
- How do I link the side images?
- How to create a container in php then customise it in CSS
- hello can you advise how to fix the error?
- Styling best practices for single pages/templates
- How to create different templates for woocommerce single-product.php?
- How do I make a shortcode to display Dokan seller badge list?
- Calling a PHP function from a menu item
- Embed dynamic media query in a Gutenberg block