3 Ways To Display Different After Header Images In Beautiful Pro Theme

In this tutorial, i’ll show you 3 ways to conditionally display different banner images after the header of the Beautiful Pro theme by StudioPress.

Here’s the question on the StudioPress Community forum i have resolved with this solution.

Seeking help with hook with conditional statement

Goal: Add a different image that displays beneath the header on specified pages.

Beautiful Pro images on different pages

If you only want to display a handful of different images, then this method is one of the best.

Lets look at 3 different options you can use or modify to suit your own preferences.

Note: All PHP code goes at the end of your child themes functions.php file & CSS should be pasted near the end of your child themes style.css file before the Media Queries.

Display Default Image On Front Page & 2nd Image On All Other Pages

This method includes code which uses the default after header background image on the front page and a second image on all other pages.


Comments

13 responses to “3 Ways To Display Different After Header Images In Beautiful Pro Theme”

  1. Amanda Taylor Avatar
    Amanda Taylor

    I am needing to have a different header just for one page. When I tried the code it worked but it duplicated my home page header on every page. What am I doing wrong?

    1. Brad Dalton Avatar
      Brad Dalton

      Hello Amanda

      This post relates to after header image, not header image however, there are 2 plugins which do the a good job.

      WP Display Header and Custom Headers Extended by Justin Tadlock

  2. Hey Brad

    Just wanted to say I found this really helpful. It also helped me come up with a solution that replaced this banner with a post’s featured image:

    [code]
    add_image_size( ‘featured-banner’, 2000, 300, TRUE );

    function amcs_featured_img() {
    if ( has_post_thumbnail() )
    the_post_thumbnail(‘featured-banner’);
    else {
    echo ‘

    ‘;
    }}

    add_action( ‘genesis_after_header’, ‘amcs_featured_img’, 5 );
    [/code]

    1. Brad Dalton Avatar
      Brad Dalton

      Thanks for the solution Andy.

  3. Thanks so much for this Brad! I’m considering using this theme on another website of mine, but I’ve noticed on sites using this theme already that the header image area isn’t mobile responsive. Like it crops it a lot if you’re looking at it on a phone or smaller device? Do you know if there’s a way to instead of adding multiple headers that are different, just upload 2 or 3 headers that are different sizes for different sized devices?

    1. Brad Dalton Avatar
      Brad Dalton

      Hello Ashlee

      You can use mobile conditional tags.

      You can do this by creating the conditional tags manually or installing a plugin like Mobble.

      1. Thanks SO much Brad! That looks fantastic! I can’t find a lot of info on Mobble though, and no youtube tutorials either. Is it just a simple download and then it does pretty much everything behind the scenes for me? Or do I still need to do some heavy lifting…eh coding?!

        1. Brad Dalton Avatar
          Brad Dalton

          You still need to write the new conditional tags into custom functions. There’s no easy solution other than coding or media queries.

          1. So I can basically just be like “if…iphone size #px…then show this image instead”?! Kinda like what you did here just for mobile devices? Sorry for all the dumb little questions but you’re the best research on all of this I’ve found yet! Thanks so much Brad!

          2. Brad Dalton Avatar
            Brad Dalton

            Thanks Ashlee.

            I will be writing about how to use mobile conditional tags in the near future.

  4. I’m wondering – could you also do this with CSS using page id?

    Like:

    .page-id-1 .site-header-banner { background: url(some image here); ……..etc?

    That way you wouldn’t have to ftp in whenever you wanted to change the image, and could just upload it right in your dashboard.

    Thoughts?

    1. Brad Dalton Avatar
      Brad Dalton

      You could with the header image yes but how would you position it after the header?

      You can just hook in a div class on its own and then add the image in your style sheet which is better in my opinion for this position because you can also use conditional tags.

Leave a Reply

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.