The CSS is generated on the file inc/custom-css.php
, the background color is set on line 76:
$background = sanitize_hex_color_no_hash( get_theme_mod( 'background_color' ) );
So you can take advantage of the theme_mod_{$name}
filter, which changes the value of the get_theme_mod($name)
function, by adding this to your functions.php file:
add_filter(
'theme_mod_background_color',
function( $value ) {
$custom_bg_page_ids = array( 18, 19, 20 );
$custom_bg_color="ca2d2d";
global $post;
if ( in_array( $post->ID, $custom_bg_page_ids ) ) {
return $custom_bg_color;
}
return $value;
}
);
Related Posts:
- is there a simple way to list every templates / php files used to generate a specific page?
- Setting up the child theme so as to enable right-to-left WordPress?
- Understanding child theme functions.php
- Overriding a theme redux file in child theme
- Want to create Child theme, but already edited Parent theme css files and some php files
- Displaying theme options in css
- Parent theme CSS overriding child CSS rules
- How to style options page in dashboard?
- Selectbox in admin panel function linking to CSS
- Can I install/embed WordPress on a ‘single page’?
- Customize position of social icons in upme plugin [closed]
- two columns of posts on homepage, one of them “favorites”
- How do I add a custom css to all posts without affecting homepage css? [closed]
- Clickable image link sends people to wrong URL
- Assign Custom classes to every Excerpt
- How to edit background color of only one sidebar?
- Inline CSS header style priority function.php Child (no enqueing I think)
- Create Columns with Custom Walker and CSS Classes
- Background image no longer fits to screen now that project is in php files
- Why would the child theme load in the Customize preview, but not on the site itself?
- How to locate parent theme functions and add functions to my wordpress child theme?
- How to let mobile navigation menu close when link is clicked?
- how to add functions to my function.php using a child theme?
- custom field – changing an element or background of id div – different versions not working
- Where to find the html for WordPress site? [closed]
- How to remove image on single product and get product to span page?
- Modify arguments for parent theme’s `wp_register_style` via child theme
- Child theme not working properly
- Child-theme suddenly stopped working [closed]
- hello can you advise how to fix the error?
- Live Preview while customizing is not showing the updates while editing in WordPress
- How to get 2 or multiple custom post types in wordpress functions.php
- Put CSS inside a PHP file and include it the right way
- Shortcode content output but not in correct place
- Multiple choice in a custom taxonomy
- An unwanted inline style is added to my body tag
- Show post in slider
- Creating bulk posts with Youtube videos
- Problem adding class to body_class
- Customizing default Mediaelement player
- Add a custom stylesheet for BlackBerry
- Random Default Avatar Function
- How can I hide Home in my menu in a specific page?
- Missing sidebar parameter “fix” – before_content
- Get different images for mobile and desktop with php, advanced custom fields without using js and ajax
- Can’t extend some core classes
- How Display Posts on category
- Hide wordpress field if data is empty in post!
- Change the site tagline (or similar) based on current page
- Trouble creating conditional PHP for nav menu items with children for custom Walker
- Setting custom canonical urls
- Only show search results with if current date is between two dates?
- How to stop featured image thumbnail [set as background image] on blog index page just repeating same image across all posts
- database interactions using OOP
- WordPress child theme fails to override parent navigation menu in /inc/structure/header.php
- Customizer: Output default value in Customizer CSS
- How to add just one specific page to widget without plugin?
- Remove one value in dismissed_wp_pointers?
- Slider loading issue
- create a select input with menus created on a custom options page
- Taxonomy linked to pages
- Where to edit the template that is generating the code for dynamic_sidebar left-sidebar in the Understrap theme? [closed]
- Plugin CSS not enqueing
- Hide Hamburger Menu On Specific Page (Front Page/Home Page)
- Create another “Display Site Title and Tagline” checkbox, “Header Text Color” setting and control
- how to remove metadata from the posts of my blog?
- Accessing data from a non-WP database/table within a page content
- WordPress blog post url on category page
- Theme Options Page – User Updates Logo
- Changing layout with wp_customise
- WP dynamic featured image – Can’t get second featured image url
- Converting HTML Template to WordPress Theme
- Extending the WP_Widget_Text class
- How to use my style.css file outside of wordpress subdomain?
- Dynamic Stylesheet loads but doesn’t finish
- How to add date to navigation bar
- Using if/else statements with output from theme options
- Is there CSS to expand the gallery limit on Index Pages?
- How to check if a meta value has already been assigned to any user?
- How to hide products that do not have an image from a slider carousel for an ecommerce webpage?
- Customize Theme comment template to Insert VoteUp and VoteDown buttons
- How to design a table based on css values set from admin/dashboard
- filter default query to show just selected level of child pages in wordpress
- Retrieve $_POST data submitted from external URL in WordPress(NOT API)
- Is it possible to add a ribbon in the background of h1 on every page?
- Trying to build simple deposit code that hooks into woocommerce
- How to pick the default selected value in wordpress dropdown?
- Add New User, extra fields which are required?
- user_profile_update_errors hook not executing
- Send an email to specific adress when button is clicked?
- Customizer: active_callback and sanitize_callback incompatibility?
- Saving and Restoring a Canvas on A Individual User Basis
- Redirect specific user role to specific site after login?
- Send multiple attachments with wp_mail in PHP
- WordPress admin pointers tour bug?
- Incorrect MIME type for assets with Valet
- How to display pictures from database?
- custom url rewrite for wordpress
- Extend plugin Class through functions.php
- How to add condition in wordpress loop? [closed]