[Resolved] Separate Blog Page header?

Home Forums Support [Resolved] Separate Blog Page header?

Home Forums Support Separate Blog Page header?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #158426
    cgu_outreach

    Hi Tom, posted this earlier at the end of a resolved thread by mistake, tried to go back and delete it but I’m too late…

    My question:

    Just tidying up our site and noticed that the custom header function works great across the whole site except for the blog page. For some reason it defaults to the generic website header and doesn’t provide the option to add a custom header as do the ‘regular’ web pages. The only option I see is from the APPEARANCE >> BLOG PAGE HEADER. That only puts a sub-header down below the main website header like below:

    N A V B A R2
    Default Custom Header
    N A V B A R1
    blog header

    where I’m trying to get the custom blog header to show where the default custom header is showing

    Clear as mud? 🙂

    Sorry for the double post.

    #158431
    Tom
    Lead Developer
    Lead Developer

    Which custom header function are you using?

    The Blog is a tough one because WP ignores metabox values on the blog page, which is why we need an “Appearance > Blog Page Header” page vs just using the regular Page Header metabox.

    #158530
    cgu_outreach

    Hi Tom, thanks for the reply.

    Here’s the php function used in the “Before Header Content” Hook

    <?php
    global $post;
    $image = get_post_meta($post->ID, ‘custom_header’, true);
    if ( ! empty( $image ) ) : ?>
    ” alt=”” style=”position: relative; vertical-align: bottom;” />
    <?php else : ?>

    <?php endif; ?>

    #158550
    Tom
    Lead Developer
    Lead Developer

    Try this:

    <?php
    global $post;
    $image = get_post_meta($post->ID, 'custom_header', true);
    if ( ! empty( $image ) ) : ?>
          <img src=".." alt="" style="position: relative; vertical-align: bottom;" />
    <?php elseif ( is_home() ) : ?>
          <img src="URL TO BLOG HEADER" alt="" />
    <?php else : ?>
          <img src="xxxxxxxxxxxxx" alt="" />
    <?php endif; ?>
    #158613
    cgu_outreach

    I had just about got to this stage with the is_home IF statement, but didn’t have the syntax correct. Your snippet got it to work perfectly once I got the right img src link in the first IF statement.
    ” alt=”” style=”position: relative; vertical-align: bottom;” />

    Works like a charm now, thanks. Killer job on going beyond the call of duty with your help on this.

    Double ‘spro is coming up 🙂

    #158619
    Tom
    Lead Developer
    Lead Developer

    No problem! Glad you got it to work! 🙂

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