[Resolved] Switch header background image using elements ?

Home Forums Support [Resolved] Switch header background image using elements ?

Home Forums Support Switch header background image using elements ?

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #693065
    Radek

    Hi, what is the best way to change header background image for one category only ? Trying use elements, but no luck. FB question with picture for better imagination here: https://www.facebook.com/groups/generatepress/?multi_permalinks=1832469000142002&notif_id=1538592516614317&notif_t=feedback_reaction_generic
    Thanx

    #693108
    David
    Staff
    Customer Support

    Hi there,

    so its only one category archive page that you want to swap the header background image?
    Can you share a link to the specific pages – you can edit the original topic and use the Site URL for privacy.

    #693121
    Radek

    No, it’ll be for more categories. Each category (archive page + all category posts) will have own header background image…
    Site is under http password protection, so if You’ll need, I can send You some login info.
    Thanx a lot

    #693124
    David
    Staff
    Customer Support

    How many categories do you reckon it will need? Just looking at what the easiest solution would be

    #693129
    Radek

    Just 2 for this moment

    #693150
    David
    Staff
    Customer Support

    OK, so for now, easiest to just target the body class of the categories with this CSS, just add as many rules as you need and add the correct slug.

    .category-slug .site-header {
        background-image: url('image_url');
    }
    #693185
    Radek

    Working for category archive, but not for category posts…

    #693198
    David
    Staff
    Customer Support

    Ok, so lets try the Hooks method.
    New Element Hook – use the WP_Head hook. Add this in the hook with the correct image URL:

    <style type="text/css">
    .site-header {
        background-image: url('image_url');
    }
    </style>

    Then you can set the Display rules using
    Posts: Post Category select the category and the same for Post Archives: Post Category Archive

    #693210
    Radek

    Exactly what I was trying before, but with bad style syntax (post at FB). Your version works perfect ๐Ÿ˜‰
    Thanx a lot for Your time.

    #693212
    David
    Staff
    Customer Support

    Awesome ๐Ÿ™‚ Glad i could be of help

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.