Do somthings

As WordPress doesn’t offer by default a featured image option for the categories, for the main header image on the categories pages, Hestia uses the Header image ( Appearance > Customize > Header Options > Header image ) or, if that image is not set, a gradient color ( Appearance > Customize > Colors > Accent Color ). But this is only a static image or Color but If you want to change this behavior and have a featured image for each category page, you can follow this tutorial.

Step by Step Implementation

1. Install and activate the Categories Images plugin.

2. Add featured images for each category following the plugin’s documentation.

3. And last but not least, add this code in your functions.php file :

add_filter( 'hestia_header_wrapper_background_filter','your_child_theme_header_wrapper' );

function your_child_theme_header_wrapper( $args ) {

if( is_category() ) {

if ( function_exists('z_taxonomy_image_url') ) {
$z_taxonomy_image_url = z_taxonomy_image_url();

if ( ! empty($z_taxonomy_image_url) ) {
return '<div data-parallax="active" class="header-filter" style="background-image: url(' . $z_taxonomy_image_url . ');" ></div>';
}
}

}
return $args;
}
Categories: WordPress

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *