free hit counters
If you are using Internet Explorer as your browser please be running at least IE 7 or above. This site does not support IE 6 or below. Go here for the latest free version including easy download and installation instructions If you want to make it real easy on yourself, download Firefox , the most popular browser in the world. It's free and simple. You'll be so glad you did.
Jan
11
2009

Add images within your header image

This technique is very similar to this one but it allows you to add as many images you want and precisely place them within your header image.  Take a look at this very simple screenshot of my header image….

headerimage9

The circle and square represent any custom images that you want to place anywhere inside your header image.  You can move them anywhere inside the header image with the following technique….

In your custom_functions.php file add this code. You can put it anywhere you want but I recommend putting it at the top after the <?php tag. Always describe the function and put it between the comment tags /*  */ at the beginning shown below in green. The comments aren’t shown on your rendered page and it just makes things easier for you to remember…

/*images inside of my header*/
function my_header() { ?>
<div id =”headerimage” ><img src=”<?php bloginfo(’template_directory’) ?>/custom/images/headerimage.jpg” alt=”clickable header” />
<ul>
<li class=”square” ><img src=”<?php bloginfo(’template_directory’) ?>/custom/images/square.jpg” alt=”square” /></li>
<li class=”circle” ><img src=”<?php bloginfo(’template_directory’) ?>/custom/images/circle.png” alt=”circle” /> </li>
</ul>
</div>
<?php }
add_action (’thesis_hook_header‘, ‘my_header‘);

Note the following:

Name your function whatever you want. I named it my_header just to make it easy

The <?php bloginfo is just a block of code that makes it easier to follow the path to your images instead of typing out the entire path.

I divided my images into separate classes which makes it easy to style with css. You can name them anything you want but use names that make it easy to identifying what you are styling

I’m hanging the function on the header hook

In your custom.ss file add the following code. You can put it anywhere you want but I recommend putting it at the top. Always describe what you’re doing by putting your descripton between the comment tags /*  */ at the beginning shown below in green. The comments aren’t shown on your rendered page and it just makes things easier for you to remember…

/*positioning images in my header*/
.custom #headerimage {
position: relative;
width: 920px;
height: 300px;
}
.custom #headerimage ul {
list-style: none;
margin: 0;
padding: 0;
}
.custom #headerimage .square{
position: absolute;
bottom: 5em;
left: 10em;
}
.custom #headerimage .circle{
position: absolute;
bottom: 15em;
right: 5em;
}

If you want to understand why you style these like I did check out this tutorial where it’s explained in detail.  Basically I’m doing the same technique where I’m assigning the header to a relative position.  Then I assign the images to an absolute position where I can precisely place them by choosing my distances from the top, bottom, right, and left of the header edges.

Leaving a comment with code in it...

If you would like to leave a comment and you have examples of code you want to show, you must "escape the code". This allows the entire code to show correctly by inserting certain variable around certain tags to make them show. If you don't "escape the code" your code will show up broken, mangled, and it won't be able to be seen correctly. "Escaping the code" is very simple...

  1. Copy your code you want to show
  2. Click here to go to the site to escape the code
  3. Follow the directions, it's so easy
  4. Once you have the escaped code copied, paste it in the comments area where you want
  5. Now you can enjoy life


Go ahead, leave a comment...

{ 2 comments… read them below or add one }

D-Dub May 3, 2009 at 11:09 pm

OK, Nasty. I appreciate the effort, but that didn’t work at all for me, and I have fully functioning custom style and functions. I also run the Open Hook plugin.

But it occurs to me that the instructions effect placement of the search box in the header and not in the nav_menu, as you have it on your site. Am I wrong? Maybe I just don’t get it, but at any rate dropping your code into my custom functions and style sheets does nothing at all.

Anyway, if you can advise me on positioning my custom search box flush right in my nav bar, which on my test site is hooked beneath my graphical header, I’d greatly appreciate it.

I found a few of your other tutorials a snap, and I thank you for them.

Best regards,

D-Dub

Reply

Nasty May 4, 2009 at 1:16 am

Sorry about the code, it’s worked for a lot of people. I’m wondering if it’s something simple like the quote marks. Make sure all of them are straight up and down and not at an angle. It’ll totally ruin the code. Sometimes that happens when people copy and paste.

Here’s a tutorial for the search bar

Reply

Leave a Comment

Previous post: Add an avatar or picture next to your title and byline

Next post: Change the size of the MM box