[Resolved] Multiple blog header images

Home Forums Support [Resolved] Multiple blog header images

Home Forums Support Multiple blog header images

  • This topic has 4 replies, 2 voices, and was last updated 7 years ago by Tom.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #306434
    Chris

    Hi Tom,

    I have an interesting one for you I think. I’m using the events calendar to display ‘performances’ and have added the following snippet to get the blog header image to display on events calendar archive pages and the main blog page:

    add_filter( ‘generate_get_blog_page_header’,’tu_performances_blog_page_header’ );
    function tu_performances_blog_page_header(){
    if ( tribe_is_event_query() && !is_single()) {
    return true;
    }
    if (is_home()){
    return true;
    }
    return false;
    }

    What I would like to be able to do is specify a different image for each situation – one for the events archives and one for the main blog page. Any idea how i’d go about that?

    Thanks!
    Chris

    #306435
    Chris

    As an addiitonal question, I’d also like to do this with the site logo – any ideas?

    #306446
    Tom
    Lead Developer
    Lead Developer

    Hi Chris,

    Currently it’s not possible with the page header add-on, although it will be in the future.

    If it’s just an image, you could use the After Header hook in GP Hooks instead:

    <?php if ( tribe_is_event_query() && ! is_single() ) { ?>
        <img src="IMAGE URL" alt="" />
    <?php } ?>
    
    <?php if ( is_home() ) { ?>
        <img src="BLOG IMAGE URL" alt="" />
    <?php } ?>

    For the site logo, there’s a filter you can use: https://docs.generatepress.com/article/generate_logo/

    Let me know if you need more info ๐Ÿ™‚

    #306452
    Chris

    Hi Tom,

    Thanks for the quick response!

    The filter for the logo is working beautifuly – thanks for that. Also found the one to alter the logo href which is also v useful!

    You suggestion for the header image put me onto the right track. Your code added an image above the generatepress header. The following does what I needed in that it alters the image that generatepress header uses for the background:

    <?php if ( tribe_is_event_query() && ! is_single() ) { ?>
    <style>.generate-content-header {
    background-image: url(IMAGE_URL);
    background-size: cover;
    }</style>
    <?php } ?>

    <?php if ( is_home() ) { ?>
    <style>.generate-content-header {
    background-image: url(IMAGE_URL);
    background-size: cover;
    }</style>
    <?php } ?>

    Thanks for yoru help – great support as ever!
    Chris

    #306547
    Tom
    Lead Developer
    Lead Developer

    Perfect! Glad I could help ๐Ÿ™‚

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