For the Avada theme, sets the title bar background image directly from the post or page featured image.
If no featured image is set for the post or page, the default theme option settings are respected.
- Download the zip (~1 KB).
- Manually upload the zip to /wp-content/plugins/auto-hero-avada or upload the zip via your wp-admin Plugins > Add New > Upload Plugin.
- Activate the plugin through the wp-admin Plugins page.
- Copy
Avada/templates/title-bar.php
toAvada-Child-Theme/templates/title-bar.php
. - Edit the copied
title-bar.php
file. - Replace
<div class="fusion-page-title-bar fusion-page-title-bar-<?php echo esc_attr( $content_type ); ?> fusion-page-title-bar-<?php echo esc_attr( $alignment ); ?>">
with this
<!-- Use this custom hook to set the title bar bg image
from the post or page featured image. -->
<?php do_action('avada_feature2hero', $content_type, $alignment); ?>
- Save.
- Set the page's Featured image.
- Scroll down to the Fusion Page Options.
- Set the Page Title Bar Height to the height of your featured image in pixels.
- Set the Page Title Bar Mobile Height to the height you need for mobile. E.g.,
720px
. - Update or Publish.
- View the page. The featured image should appear as the hero image for the page.
- Disable the first featured image for the post or page as needed.
- Adjust the page title bar settings to what you like. E.g., 64px for the title font size.
- See the optional CSS below for creating an darkened overlay.
/**
* Auto Hero Styling
*
* Based on https://theme-fusion.com/forums/topic/featured-image-into-page-title-bar-background/
*
* Modified to fit BEM.
*/
/* Overlay Attributes */
.fusion-page-title-bar--overlay {
background-blend-mode: soft-light;
background-color: rgba(0,0,0,0.5) !important; /* Intensity: less is brighter; more is darker */
}
/* Background Attributes */
.fusion-page-title-bar--background {
background-position: center center !important;
background-repeat: no-repeat !important;
background-size: cover !important;
}