speedyp
Sophomore
Just Getting Started
Member Likes (0)
I'm using the <?php echo catch_that_image() ?> function. I want to add the code to my header.php so that it looks in an existing page and then displays the image it finds there in the site's header.
So, how do I add the path to a page, grab the image and then display it in the header?
Thanks for any help

Responses (20)
Ach Crivvens (joined August 2011) Likes (0)
Hi speedyp, thanks for your post.
catch_that_image() isnt a standard WP function......where did you find this?
You should really be using the featured image functions, these are easy to link into and display the images where ever.: http://codex.wordpress.org/Post_Thumbnails
Or if you do want to collect the first image in a post and display it then try this tut: http://www.wprecipes.com/how-to-get-the-first-image-from-the-post-and-display-it
Let us know if you need further help.
Hope that helps ya
Member (joined July 2012) Likes (0)
Well thanks for replying.
See that second link you suggested? That's what I'm already trying. It uses the wp function "catch_that_image".
I need a bit of script that will:
Look in an existing page
Grabs the image from there
Display that image on every page in the header
It's the "looks in an existing page" that I'm stuck on...???
Ach Crivvens (joined August 2011) Likes (0)
Oh yeh I see its using that function name......its not a WP function though, by that I mean its not a standard WP function from the codex. Its a custom function, created by someone.
SO what you are saying is this function isnt working for you? Because everything you want to achieve can be done from code on this page apparently.
However I have to say I think you are going about this the wrong way if I understand what you want to do. Much easier to link into WP's featured image functions.
So let me just clarify: You have an image on a page, this image should be displayed in the header. This is the same for all pages. Do you also want it displayed within the post?
I can write you a quick tut for using featured images? It wil allow you to set a featured image, then display each pages featured image where ever you like...
Member (joined July 2012) Likes (0)
YES, YES & YES! :)
A bit of background - my first multisite. Need an EASY way for members to display a foreground image in the header, like a logo.
The idea is that each subsite will have a special page called "logo". They can use that to upload their own image.
The bit of code I hope you're going to help me with will:
Look in that page.
Grab the image it finds there.
Display that image in the header on every page throughout the site.
If you can show me how to that I will be eternally grateful :)
Thanks
Inactive (joined February 2012) Likes (0)
Hey @speedyp
I have followed through the thread and I get the idea. However if you are trying to just accomplish...
...why don't you just use the Header feature of WordPress?
see this: http://millionclues.com/problogging/wordpress-tips/make-your-theme-wordpress-3-0-compatible/ and the section for the header image titled "Enable Custom Header Management to Change Header Images Easily"
That should be exactly what you need, right?
Ach Crivvens (joined August 2011) Likes (0)
Hi,
Yeh Arun is right if you want to allow users to add a custom logo to their sub site then I wouldnt use what Ive suggested (sorry I thought you wanted something else).
What themes are your subsites using? Is it a custom one I take it? If so I would use theme options for logos, allowing people to load a logo in a "Theme Options" page in their wp-admin.
Do you know how to do this or would you like a wee tut on this?
Member (joined July 2012) Likes (0)
Thanks Arun, but I already have header & background images covered.
I'm after the ability to add an EXTRA image, on top of the header background...
Cheers
Member (joined July 2012) Likes (0)
Ach Crivvens...
If I ended up with 3 options in the wp appearance tab for header, background & logo that would be amazing!
And yeah, it's custom theme I designed with Artisteer...
Help ma Boab :)
Ach Crivvens (joined August 2011) Likes (1)Liked by: 
OK rather than write one myself I found this one that looks decent:
http://wp.tutsplus.com/tutorials/creative-coding/how-to-integrate-the-wordpress-media-uploader-in-theme-and-plugin-options/
Good logo uploader bit there, with preview and delete functions!
Member (joined July 2012) Likes (0)
Well thanks for that link.
It looks a wee bit overwhelming at first glance - if I get stuck, will you still talk to me?
Cheers
Member (joined July 2012) Likes (0)
WOW! That was easier than I thought. Didn't realise the code files were included in the tut. Superb - just what I was after and it's already working in my theme :)
Expect it will be possible to edit the files so the button doesn't say wp-tuts options.
THANK YOU to you & the tut author :)
Inactive (joined February 2012) Likes (0)
The user is setting only one custom header right? The other header is standard for all users, is it so?
Why don't you make the fixed header part of the theme and have the custom image available via the header image upload area?
OR you could simply use the get_post_meta wp function: http://codex.wordpress.org/Function_Reference/get_post_meta
All blogs will have the hello world post with post id 1. Just ask users to create a custom field for that one and set the value as the full url to the image.
Suppose the custom field key is "headerimage". You could use it like this:
< ?php echo get_post_meta(1, "headerimage", true); ? >I hope this works for you :)
Inactive (joined February 2012) Likes (1)Liked by: 
Ah! we were working on it together. Glad it worked :)
Member (joined July 2012) Likes (0)
Thanks Arun - even more to think about :)
Inactive (joined February 2012) Likes (0)
You are welcome :)
Ach Crivvens (joined August 2011) Likes (0)
Crivvens speedy that wiz fest ken.
Glad you got it sorted dude.
Look now for changing background options and build that in....yes you can change "wp-tuts options" to whatever you want.
Cheers
Member (joined July 2012) Likes (0)
Ayberdeen or Dundeh?? :)
I'm in Sunny Auld Reekie Ken?
Inactive (joined February 2012) Likes (0)
Is this some sort of alien language? Klingon?
Ach Crivvens (joined August 2011) Likes (0)
Im from Perth originally but sister stays in the Deen noo.
@Arun Aye Scottish Klingon ;)
Inactive (joined February 2012) Likes (0)
[lol] <- Am told that is Klingon ;)
Become a member