• How do I set a header image for my blog pages that is different from the homepage header? I see how to set a custom header for individual pages or posts but not for category pages…

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Theme Author Kharis Sulistiyono

    (@kharisblank)

    Hello there,

    Thank you for reaching out to me here.

    For header image on specific post’s category, you could use the below snippet:

    
    add_filter( 'theme_mod_header_image', 'quna_my_custom_header_image', 37 );
    function quna_my_custom_header_image($url) {
    
      if( is_category('nice-look') ) {
        $url = 'https://www.wakecountybeekeepers.org/wp-content/uploads/2019/01/farmerlmafk.jpg';
      }
    
      return $url;
    
    }
    

    Replace the category slug name in this line if( is_category('nice-look') ) { to match with your own. And define an image URL in $url variable. You can get it from the media library (Dashboard > Media).

    To apply it to your site, you can use Code Snippets plugin. Ensure it’s enabled on front-end.

    Regards,
    Kharis

Viewing 1 replies (of 1 total)
  • The topic ‘Header image’ is closed to new replies.