Title: modify header image
Last modified: May 30, 2017

---

# modify header image

 *  Resolved [windofchange87](https://wordpress.org/support/users/windofchange87/)
 * (@windofchange87)
 * [9 years ago](https://wordpress.org/support/topic/modify-header-image/)
 * Hi everyone, I would like to change the header image within the pages and categories
   in the div “newsmag-custom-header” instead of the default image.
    How can I customize
   the image for each one?
 * [esempio](http://www.salutebuongiorno.it/category/fitness/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Miha](https://wordpress.org/support/users/mplusb/)
 * (@mplusb)
 * [9 years ago](https://wordpress.org/support/topic/modify-header-image/#post-9179528)
 * Hi [@windofchange87](https://wordpress.org/support/users/windofchange87/),
 * You can change the header image for each page. Just edit a page and add it a 
   featured image.
    As for the categories, take a look here: [https://github.com/MachoThemes/newsmag-lite/blob/master/archive.php#L18](https://github.com/MachoThemes/newsmag-lite/blob/master/archive.php#L18)
   This is where the default image is added. You will need to check if it’s the 
   category page because that template is used for multiple pages. After that, get
   the category image and display it.
 * Best regards,
    Mihaela
 *  Thread Starter [windofchange87](https://wordpress.org/support/users/windofchange87/)
 * (@windofchange87)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/modify-header-image/#post-9201273)
 * Thank you for the reply,
    I opted for this solution I do not know if right, but
   at least it works
 *     ```
       $current_category = single_cat_title("", false);
       $current_category = strtolower($current_category);
       $current_category = str_replace(" ", "-", $current_category);
       if ( is_category( '8' ) ){
       	$current_category = str_replace("società", "societa", $current_category);
       }
       $current_category = get_template_directory_uri() . "/assets/images/" . $current_category . ".png"; 
   
       if ( ! empty( $current_category ) ): ?>
       	<?php 
       		$additional = 'style="background-image:url(' . esc_url( $current_category ) . '"' 
       	?>
       <?php endif; ?>
   
       	<div class="newsmag-custom-header" <?php echo $additional ?>>
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘modify header image’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/newsmag/2.4.4/screenshot.jpg)
 * NewsMag
 * [Support Threads](https://wordpress.org/support/theme/newsmag/)
 * [Active Topics](https://wordpress.org/support/theme/newsmag/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/newsmag/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/newsmag/reviews/)

## Tags

 * [header](https://wordpress.org/support/topic-tag/header/)

 * 2 replies
 * 2 participants
 * Last reply from: [windofchange87](https://wordpress.org/support/users/windofchange87/)
 * Last activity: [8 years, 11 months ago](https://wordpress.org/support/topic/modify-header-image/#post-9201273)
 * Status: resolved