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 define and link full path to css located at a random folder on header.php
- Get the blog page URL set in Options
- How to add CSS class to custom logo?
- 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
- Solutions for generating dynamic javascript / CSS
- Do I actually need to link my theme’s style.css in the theme files
- Using classes instead of global functions in functions.php
- Enqueue a stylesheet for login page and make it appear in head element
- What is the difference between wp_register_sidebar_widget and register_widget?
- CSS classes for theme
- Generating CSS Files Dynamically Using PHP Scripts?
- Enqueue Stylesheets After Theme’s “rtl.css”
- Change admin bar to default:off
- Are the WordPress Core CSS styles really all nessesary?
- Understanding wp_add_inline_style
- Create “File-less” Page Template in Functions.php
- Any alternate TinyMCE4 themes / subthemes?
- Splitting WordPress theme CSS into multiple files, good or bad?
- Hide a div that is part of all pages on one specific page
- 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?
- Editing the custom background CSS
- 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 bbPress template files – WordPress + BuddyPress + bbPress? [closed]
- How to edit an existing WordPress theme? [closed]
- Suggestions for creative use of post format feature, or themes that use them well
- Add class to before_widget for all widgets with a dropdown and a counter
- How to change post thumbnail title and alt attributes to post title?
- Why might $input (Settings API) be coming through empty?
- add generated stylesheet from parent theme after child-themes style.css
- Add a preview to a WordPress Control Panel
- use add_action(‘wp_head’) in a widget for generating dynamic CSS styles
- Setting up partial Right-to-Left admin interface
- Override default cropping in WordPress [duplicate]
- Adding inline styles from a widget
- Get password when user registers and save it sha1 into database
- Can’t edit style.css in subdirectory of my theme?
- Adding dashicon fonts to the admin of pre 3.8 installs
- How do I “unhook” / de-register jQuery so that it’s not called as part of wp_footer();?
- How to Handle CSS for Multiple Header header.php Files?
- Removing the default sidebar from admin panel
- Merging PHP download script into `functions.php`
- Is there an error in get_the_tag_list()?
- 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
- Move my theme style.css into a folder
- Convert a static website to a WordPress theme and import all existing content
- Allow users to add custom functions to wordpress theme
- How to keep theme layout the same when admin gray bar is present?
- Enqueued Stylesheets Effecting Admin Styles
- Change date number to another language/script?
- How to add custom template tag in wordpress theme?
- Custom CSS In Uploads Folder
- There’s an image named g.gif somewhere in my WordPress site
- wp_head() not inserting the default stylesheet style.css
- How to highlight the current page in the nav menu?
- Nesting Functions within Functions
- Is using eval() ok in this scenario
- Writing Clean WooCommerce Styles
- Custom php page in WordPress theme?
- First completely customized theme, where should I start?
- Root Sage theme styles are not working!
- De-registering parent style sheet css recommended?
- Whats the safest way to output custom JavaScript and Css code entered by the admin in the Theme Settings?
- Alterntives to BEM syntax that comply with WordPress coding standards? [closed]
- Can’t access WordPress functions in file called via Ajax?
- Modify the Additional CSS section (adding a disclaimer)
- How to add background image control to page admin controls?
- How can I customize wp_footer, where is the code that controls what this function does?
- Sub folder CSS that’s read by Admin panel
- How to list all images in uploads directory except those that are attached to any post
- WordPress 5.8 update problem custom theme styles are overridden by core styles common.min.css
- WordPress default theme css units
- CSS won’t style output of wp_nav_menu() correctly
- More than one meta field in a single meta box?
- Where is definied the theme location for the main menu in a WordPress template?
- Is there a theme function for is_password_protected()?
- how do you create an admin interface in plugin for your theme
- Is it necessary to prefix every css class in a theme framework?
- current-menu-item class not working
- enqueue_style is not working
- Custom CSS without css.php file
- Toggle Sidebar Display
- Dequeue a style file which is making website load slow!
- How to Edit the style of header title of Twenty Eleven Theme?
- Weekly background code not working
- How to store functions in… functions.php?
- Unhook jQuery from WooCommerce via `functions.php`? [closed]
- trying to use wp_handle_upload with ajax