WordPress.org

Support

Support » How-To and Troubleshooting » How to Include Banner Image on Just One Single Page

How to Include Banner Image on Just One Single Page

  • Weeniebaste

    @weeniebaste

    Hello everyone. I need help resolving a problem that I’m sure is simple, but I can’t figure out for the life of me. I’m new to writing WordPress code, so that’s probably why I’m stumped.

    I want to include a banner image on just one single page. This particular page on my WordPress site is a blog (the rest of the pages on my site are non-blog, regular and straightforward web pages). I would like to include a banner on that blog page, but make sure it doesn’t appear on any other page. I have tried following the suggestions of other questions/responses on the forum, but for some reason I’m not getting something and/or I’m doing something wrong. I need to know:

    – what code I should use to get that image banner on just one page and use it as a header
    – in what php template I should place that code
    – where in the php the code should go

    Along with this, how can I remove other header information (name of site, subtitle) on that one single blog page to where there is only the banner image at the top of that one page.

    Remember, I’m new to all of this, so I would appreciate clear and careful suggestions for a newbie.

    Much thanks!

Viewing 15 replies - 1 through 15 (of 36 total)
  • Ryan Yu

    @geeksfolder

    Hey Weeniebaste,

    Can you post the blog url that you want to add the banner in?
    So just to make sure, you want to display the banner only on ONE page right?

    Weeniebaste

    @weeniebaste

    Hi Geeksfolder. My website is http://derekroyal.com, and the page I want the banner on is http://www.derekroyal.com/?page_id=92. I’m using the Mazeld theme, if that makes any difference. And yes, I only want to display that image banner on only that one page.

    Much thanks!

    Ryan Yu

    @geeksfolder

    As Mazeld theme is the child theme of TweentyTen you will have to get the page.php file from TweentyTen.

    Log in your FTP software (like FileZilla) and go to wp-content/themes/twentyten.
    Download page.php and open it up in the preferred text editor.

    Add this code in the area you want to put the banner ad.

    <?php
    if (is_page(92)) {
    ?>
    YOUR BANNER AD CODE GOES HERE
    <?php
    }
    ?>

    Upload the page.php to your Mazeld theme located in wp-content/themes/mazeld

    If you are not sure all the process above, let me know exactly where you want to add your banner in. Also post your banner ad code. I will create the page.php file for you.

    Weeniebaste

    @weeniebaste

    Much thanks again, Geeksfolder. I can ftp the file and then upload it to the Mazeld folder, no problem. But in terms of the banner code, what do I put? Sorry to sound ignorant, but this kind of coding is new to me. I know HTML, but working in php files, I’m a newbie.

    FYI, the image banner I want to put up on that page, ID 92, is at http://www.derekroyal.com/wp-content/themes/mazeld/blogheader.jpg

    Ideally, I’d like that to be the only header on the page, without the name of the site (my name), the subtitle (“Making the World Safe for Things and Stuff”) and the rotating image that appears on the right next to the title.

    Ryan Yu

    @geeksfolder

    I see, so you want to have the header graphic on the specific page, is that right?

    Then what you need to do is,
    go to Appearance > Editor
    and click Header link in the right side bar
    and replace this section (from line 38 to line 53)

    <div id="header">
    ...
    </div><!-- #header -->

    to the code below.

    http://pastebin.com/DU1TkdYe

    Please note your new header graphic is smaller than the total width of the header area, so I centered it.

    Weeniebaste

    @weeniebaste

    Thanks again, Geeksfolder. I did as you suggested, editing the header.php file by making the appropriate substitutes, but it didn’t work. Am I doing something wrong?

    Ryan Yu

    @geeksfolder

    Can you post your header.php code using pastebin.com please?
    I will take a look.

    Weeniebaste

    @weeniebaste

    Geeksfolder – I’ve posted both my header.php file (which has the changes you recommended) and a file named header_backup.php (which is the original header.php before any changes). You can find them at:

    header.php: http://pastebin.com/84Xhd9a9

    header_backup.php: http://pastebin.com/JUuGvv0g

    Again, much thanks for all of your help on this.

    Ryan Yu

    @geeksfolder

    I see, the page you want to add the new header graphic to is not a static page, but the index of blog entries…

    In that case, change

    <?php if(is_page(92)) { ?>

    to

    <?php if(is_home()) { ?>

    from the code I gave you, it should work.

    Please let me know if it doesn’t still work.

    Weeniebaste

    @weeniebaste

    This is great, Geeksfolder. It worked. I really do appreciate all of your help with this. One other thing: even though I wanted to get rid of the title and substitute it with the image banner, I wanted to retain the menu bar that comes right under the title/subtitle on all the other pages (so readers can get from one page to another easily). What code should include to restore the menu to that one blog page, ID 92?

    Thanks again!

    Ryan Yu

    @geeksfolder

    Hey Weeniebaste,

    This one should work 🙂
    http://pastebin.com/T3hyF1nw

    Weeniebaste

    @weeniebaste

    That did it. Much thanks, Geeksfolder! You da man!

    Weeniebaste

    @weeniebaste

    Check out the blog now, particularly the entry I just put up today: http://www.derekroyal.com/?p=865.

    Ryan Yu

    @geeksfolder

    Awesome, let me know if you have any other problems!

    BTW you’ve got some interesting articles on your blog 🙂

    Weeniebaste

    @weeniebaste

    Thanks for the good words, Geeksfolder. Check out my other blog, the Gallery of the Absurd: http://galleryofabsurd.com. Less serious, more strange.

Viewing 15 replies - 1 through 15 (of 36 total)
  • The topic ‘How to Include Banner Image on Just One Single Page’ is closed to new replies.
Skip to toolbar