For the TwentyEleven theme, you can place this above your BODY tag in header.php. The theme will recognize that $header_image is already set, so no other mods would be necessary.
$header_image = get_header_image();
$image = basename($header_image);
$image = explode('.',$image);
$class="header-image-".$image[0];
Add the $class parameter to the body_class function to insert your header image class.
body_class($class);
Related Posts:
- Why max-width:97.5% on content images?
- why does twenty eleven theme mix up the css measurement units?
- JQuery undefined and Stylesheet loads in bottom along with js files
- Can’t change theme name
- .current_page_ancestor broken in Twenty Eleven
- How to add custom css file in theme?
- How important is it to enqueue a theme’s stylesheet?
- CSS not updating in browser when I change it
- Using classes instead of global functions in functions.php
- What is the difference between wp_register_sidebar_widget and register_widget?
- Enqueue Stylesheets After Theme’s “rtl.css”
- Change admin bar to default:off
- Are the WordPress Core CSS styles really all nessesary?
- Any alternate TinyMCE4 themes / subthemes?
- Splitting WordPress theme CSS into multiple files, good or bad?
- Why I can’t add a CSS style in this WordPress theme?
- Can’t get staging site to display same way as live site. Completely stumped
- How to make a theme with more than one CSS file?
- Why to check if function doesn’t exists in functions.php?
- When to use esc_url, esc_html, esc_attr, and friends?
- How to edit an existing WordPress theme? [closed]
- Suggestions for creative use of post format feature, or themes that use them well
- Add a preview to a WordPress Control Panel
- use add_action(‘wp_head’) in a widget for generating dynamic CSS styles
- CSS in child theme not overriding the parent theme [closed]
- Returning Variables back into a template
- How to add (css) classes to only one wp_nav_menu()?
- Adding dashicon fonts to the admin of pre 3.8 installs
- Allow users to add custom functions to wordpress theme
- How to add custom template tag in wordpress theme?
- Custom CSS In Uploads Folder
- Nesting Functions within Functions
- Writing Clean WooCommerce Styles
- De-registering parent style sheet css recommended?
- Alterntives to BEM syntax that comply with WordPress coding standards? [closed]
- Modify the Additional CSS section (adding a disclaimer)
- How can I customize wp_footer, where is the code that controls what this function does?
- How to list all images in uploads directory except those that are attached to any post
- More than one meta field in a single meta box?
- Is there a theme function for is_password_protected()?
- enqueue_style is not working
- How to Edit the style of header title of Twenty Eleven Theme?
- Unhook jQuery from WooCommerce via `functions.php`? [closed]
- How do the default themes reference style.css?
- Media Uploader in custom path
- Is it possible to edit the styling of the admin panel from within a custom theme?
- Theme Loading Into Dashboard
- What are the Entry classes for?
- Using PIE CSS in WordPress. “localizing” styles
- How to edit my theme for full width?
- How to check if a WordPress core block is active in sidebar
- Which html elements should be styled in wordpress theme
- How to add styles set by user in the customizer
- Why doesn’t my css work when I check my theme on mobile devices? [closed]
- WordPress Unite Theme: Footer isn’t sticking [closed]
- Following Web Performance Optimization techniques to output static and dynamic css
- Theme Customizer not loading JS for live preview
- How can I add custom text styles to the visual text editor?
- Displaying icon image for WordPress post formats, is there a cleaner way to do this?
- Internal Stylesheet in WordPress Theme development
- Replace function in a child theme
- Combining CSS files into a single cached one
- How to change footer or for different kinds of users in wordpress?
- How do I use a color from theme options?
- Replace single_template filter with what for default posts?
- Ideal inline dynamic CSS injection
- Some questions about how proper add 2 CSS file in a WordPress theme?
- Broken theme, template is missing
- Apply styles to blockquote element with the WYSIWYG editor
- How to reverse engineer the Twenty Eleven background image uploader?
- How do I use wp_nav_menu?
- Assign custom classes to the divs inside the loop
- theme-independent CSS/JS files
- why can’t i add front.css to my frontpage.php
- Customize Option Framework
- Some doubts about WordPress handle the horizontal main menu visualization
- How to set default values for edit_post_link() in my theme?
- header, stylesheet not being read
- What is the difference between Twenty eleven & roots framework?
- Is there a list of default generated Gutenberg block CSS? Unable to align video blocks
- Advanced method to control cache of enqueued style/script
- How to create a robust and logic class naming system in WordPress theme developing?
- Problem with displaying CSS Stylesheets – Am I adding them correctly in my wordpress child theme?
- How do I change the color of individual page titles in WordPress?
- How to reduce the vertical space above and below a ul list uniformly with one command?
- How to display only the first two elements from ten same elements
- Necessary css classes to be included in theme stylesheet
- Images use & location, on new wordpress theme
- How to fix an issue with customizer live preview?
- WordPress Customization API overwrite LESS variable
- How can I fix the even/odd child classes comments so that the comments are unaffected by the top-level even/odd?
- editor style css and page template with and without sidebar
- Custom link color or stylesheets
- loading custom.js file after jquery is loaded
- Setting different CSS for all pages except home.php
- How to highlight current menu bar base on the URL?
- Creating custom function in wordpress to return data from database
- How customizable is a self-hosted WordPress blog compared to a Blogger blog?
- Adding a new layout for genesis
- Image and font support missing in editor when deploying theme remotely