HeadImage WordPress Plugin

I’ve created a plugin for WordPress that will change the header background of a page based on a custom field for the first post on that page. This was requested by my buddy Walter Costinak and you can see it in action on his blog (click on individual entry titles to see the header change).

If the first post on a page has no head_image custom field set the additional CSS line won’t be written and you’ll get the theme’s default image. The default settings are for the Benevolence theme/stylesheet but should be easy to modify to work with any style you’re using.

The source is available here. Copy this into a fresh headimage.php file, and make changes to the two defined variables if needed. Then upload it in your wp-content/plugins directory and activate the plugin.

Upload a header image into your /images directory (or whichever directory you’ve defined if you changed the variable) and then add a custom field to your entry with the key “head_image” and the value being the name of the header image file.

Update: I’ve updated the plugin to version 1.0 and it now works with WordPress 2.1!

38 thoughts on “HeadImage WordPress Plugin

  1. That’s the one. He’s been a friend and mentor for ages, and has always hummed and hawed about making a blog and finally asked me to set one up for him. He’s enjoying it so far, I think.

  2. Hi Puck.
    Just two comments while the idea is so great, its a shame. I like your solution.
    I’m looking for something you have build but then slightly different.
    I also like to change the banner when clicking on a post and bound to the category. In my case when talking about planes I want planes as a banne, when talking about the old days I want the old days as a banner, You get the drift.
    Then I do not find any reffernce to #masterhead in my theme, I have a theme installed that is doeing the header.jpg thur a CSS file. I’m not that familiar with CSS yet altough started to tweak with tryal and error.
    Feel free to take a peek at my blog. Oh did I told you its in Dutch :(
    Thanks.

  3. Pingback: Blips… » Weblog gezicht

  4. hello
    i´d like to integrate your plugin into my wordpress 1.5 site with kubrick as the default theme but with no success. can you help somehow in how to make it with kubrick?
    thanks.

  5. Lars — Kubrick is a little tricky as the top image includes whitespace, so be sure to include some of that in your image. Or modify the layout so it doesn’t use the whitespace…

    Kubrick also sets its images in the HTML of the Theme and not the CSS. He claims this is to accomodate differing install paths, but I don’t see any reason for this to be required.

    That said, the CSS element you need to be setting is called “#headerimg” in Kubrick. Change the plugin’s $headerstyle = “#masthead” line to $headerstyle = “#headerimg” and it should work fine.

  6. Pingback: empdesign » Blog Archive » Plugins Wp

  7. Pingback: Netlex News » Blog Archive » HeadImage Wordpress Plugin

  8. hello puck,

    thank you for your help and the plugin, i tried it with kubrick and got it working besides some troubles in the admin area. now i have integrated it into another page and another theme without problems. thank you

  9. Pingback: Northern-Web-Coders » HeadImage

  10. Hello Joe,

    I wanted to use the HeadImage plugin on my WordPress 2.0 install, but it appears that it is not compatible (it breaks the image upload functionality) any chance of an upgrade?

    By the way, the download is broken, found the code using Google cache.

  11. Sorry about this, but the plugin *does work* on WordPress 2.0. I just made a copy/paste mistake that broke the code…

    The download link is still broken b.t.w.

  12. Hi!

    First of all thank you for this plug-in….but I got some problems:

    In my css-style the header is:

    #header {
    height: 295px;
    background: url(images/header.jpg) no-repeat;
    position: relative;
    top: 0px;
    margin: 0px;
    margin-top: 0px;
    }

    So I changed $headerstyle = “#header” in the headimage.php.

    For testing reasons I wanted to change my header in my category webdesign, so I added the key “head_image” and the value “header2.jpg”…The link to this image is http://www.florian24.com/blog/wp-content/themes/flopsycho/images/header2.jpg

    The Problem is now, if I open the category “webdesign” no header image at all is shown, if i go back to the main page, the standard header is shown.

    I don´t know what´s wrong !!??

  13. Pingback: Der wilde Garten | Verschiedene Header

  14. Does this plugin also change the header for pages and subpages? (I looked at Walter’s site but don’t see any pages).
    Thanks, Garrett

  15. Please! I need help!

    How I can modify the script in order that instead of getting the first post of the page, script gets the first post of a determined category?

    I only need to know how to indicate this on $post = $posts[0];

    Thank you in advance!

  16. Pingback: Los Blog’s de la pagina de UiDoS » Plugins para WordPress

  17. Hey!

    I use the “Freshy”-Theme and I changed the variable to “#header”. Then I added a custom field to my entry with the key “head_image” and the name of the header image file. But when I open the category nothing changes…there is still the standard header. Can u help me? :-3

  18. Pingback: Profesor Blog » Los Mejores Plugins Para Worpress

  19. Pingback: » Enchula tu Blog,Plugins Para Worpress Información Tecnología Internet y Gadgets

  20. Pingback: La Mansion » Blog Archive » Plugins Wordpress

  21. Pingback: 282 plugins para WordPress (3ª parte de la F a la K) | Pichicola.com

  22. Pingback: Más plugin para Wordpress « El Cubanito Web

  23. Pingback: Inicio « mediasur.cl

  24. Pingback: Plugins para Wordpress. | Puydi Publicidad 100% efectiva

  25. Pingback: webmaster esmuy.com » Blog Archive » Plugins para Wordpress

  26. Pingback: Plugins para Wordpress para usar con blespot.com | Scorts Cd Juarez

  27. Pingback: Oloroko Blog – Lista de Plugins para Wordpress

  28. Pingback: WwW.UrbaNicaNo.Net || Tu Web De Reggaetón & Eventos Urbanos » Plugins para Wordpress

  29. Pingback: Plugins para Wordpress de la A a la Z. | La Fanega

  30. Pingback: Plugins para Wordpress «

  31. Pingback: prueba « ALEJANDRO RAMIREZ OSORIO

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>