can you please show me hot it is done in the code?The header is logo.gif
Main Topics
Browse All TopicsI have a custom theme in wordpress and would like to have a different header on each page
the pages are the following:
Travel Journal, About Us, Media Resources, Support, More
I attached the code from the current header.php file
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
There's a couple of different way that you could do this.
The best way would be to use a custom field - then you would use the custom field to point to an image. Since this is outside the loop, the code is a bit different.
So lets use headerImage as the name of the custom field
To use this (because you are outside of the loop) you can use this code:
<?php
global $wp_query;
$postid = $wp_query->post->ID;
echo get_post_meta($postid, 'headerImage', true);
?>
So on each page / post you need to define headerImage in the "custom fields section of your page".
So your code should become this:
<img src="<?php bloginfo('stylesheet_direc
So upload all the different images to the same folder your images are in now. Then, define the custom field (headerImage) using the file name. So on one post / page it could be "logo.gif" then on another you could have "logo8.jpg".
I hope that's clear.
I don't understand well
how will the final file look like? what do you mean outside the loop?
I saw that the wp control panel has a field for custom code name and value.
on name should I add the name of the image?
and on value:
<img src="<?php bloginfo('stylesheet_direc
is this correct?
I found the solution on the following link:
http://wpguru.co.za/header
it also uses the custom fields
but the code that goes in the header.php is:
<? if (get_post_meta($post->ID, 'header', true)) { ?>
<img src="<? bloginfo('url'); ?>image path<? echo get_post_meta($post->ID, 'header', true) ?>" alt="<? bloginfo('name'); ?>" />
<? } else { ?>
<img src="<? bloginfo('template_directo
<? } ?>
this code replaces the <img src of the image of the header
in the custom field
you use header in the key
and the name of the file in value
Sorry - I should have explained better.
The loop is what displays the posts on your page. It looks like this:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
and ends here:
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
The code that you use to call a custom field is different if your code is outside of that loop.
I would say the code that you found is slightly better - I should have included the else statement.
Take a look at these pages, it will really help you in your WP theme development / skills:
http://codex.wordpress.org
http://codex.wordpress.org
http://codex.wordpress.org
Glad you found the solution!
Cheers,
Mike
Business Accounts
Answer for Membership
by: jmyeomPosted on 2009-11-07 at 07:59:51ID: 25766740
i think wordpress defines what page it is, so try look for that ..
if( THISPAGE =="About Us") {
blah blah blah
}
or
if( THISPAGE =="About Us") {
include "header.php?ID=about us";
}