25. June 2012
von Blackbam

Update: There was a short intverview regarding this Plugin by expertentesten.de: https://www.expertentesten.de/news/interview-david-stoeckl-custom-header-images-plugin/(language is german).

Why does WordPress need another Header Images Plugin? Really, there are a lot of Plugins for this purpose so why did I have to write another one? The answer is: All these plugins have a lot of code, it is hard to extend these by oneself and unfortunatly none if these is really simple to maintain, extend and to understand. I was searching for hours for the right header image Plugin which provides the functionality that i needed in a simple clean and easy way, without custom tables and buggy built-in uploads, wihout required theme support and so on. So here is my answer: A quick and easy WordPress Plugin to do this job.


  • Simple and easy management of header images
  • Each possible state is covered, by using the WordPress template hierarchyfor diffentiation
  • The Media Library is used for image management, images are saved by URL copy/paste (so external images can be used, too)
  • Requires no extra tables
  • NEW: Support for Custom Post Types (Single Custom Post Images) and Custom Taxonomies (Taxonomy Page Images)
  • Clean install/uninstall
Be free to post improvement ideas and feature request as a comment to this post.


>> Download this Plugin <<

  1. Upload the Plugin to your wp-content/plugins/ folder
  2. Activate the Plugin
  3. Go to Settings -> Header Images and insert the image URLs (get the URLs from the media library)
  4. Paste one of the following codes into your theme:

NOTE:This code must be put into PHP brackets!

// standard code
if(function_exists('chi_display_header')) { chi_display_header(); }

or this code, use concrete numbers for width and height in pixels:

// f.e. chi_display_header(960,250); for header images with 960 px width and 250 px height
if(function_exists('chi_display_header')) { chi_display_header($width,$height); }

Warning: You can only use conditional query tags after the posts_selection action hook in WordPress (the wp action hook is the first one through which you can use these conditionals). For themes, this means the conditional tag will never work properly if you are using it in the body of functions.php, i.e. outside of a function (http://codex.wordpress.org/Conditional_Tags).


============ UPDATE: 2014-02-01 ==========

Some functions were added for better flexibility:

chi_get_header_image_url(); // get only the URL of the header image


chi_get_header_image_link(); // get only the Link of the header image


chi_get_display_header_data($width=-1,$height=-1); // get the full output of the plugin into a variable, but do not display it


Responsiveness tutorial (short)

For the sake of responsive web design, you will not be happy to put out the same header image on every device (as huge header images are not good for mobile devices to load). Therefore I suggest the following solution which should work well for you:


  1. Instead of calling  chi_display_header(); you call chi_get_header_image_url(); and pass it to a Javascript variablet
  2. Install the timthumb library on your WordPress installation
  3. Use Javascript to get the image in the desired size from timthumb.php by passing the original image url


How to change header images...

  • Go to Settings ->Header images (general images)
  • Meta Boxes at the bottom of post / page edit screen
  • Category add/edit screen


Q: The Plugin is not displaying the header images correctly. What is wrong?

  • The function code must be pasted into one of your template files, the best place in most cases of use is the bottom of header.php
  • This Plugin uses conditional tags. Please make sure that your wp_query object has been loaded correctly, before the code is executed.

Warning: Undefined variable $time_since in /home/.sites/609/site1266/web/blackbams-blog/wp-content/themes/SilentWoodsByBlackbam/single.php on line 42 Dieser Eintrag wurde am 25. June 2012 um 1:01 in der Kategorie Plugins, WordPress veröffentlicht. You can book the comments for this article RSS 2.0. Feedback, discussion, commendation and critics are welcome: Write a comment or trackback.


Fatal error: Uncaught Error: Undefined constant "Ext_related_links" in /home/.sites/609/site1266/web/blackbams-blog/wp-content/themes/SilentWoodsByBlackbam/single.php:75 Stack trace: #0 /home/.sites/609/site1266/web/blackbams-blog/wp-includes/template-loader.php(106): include() #1 /home/.sites/609/site1266/web/blackbams-blog/wp-blog-header.php(19): require_once('/home/.sites/60...') #2 /home/.sites/609/site1266/web/blackbams-blog/index.php(17): require('/home/.sites/60...') #3 {main} thrown in /home/.sites/609/site1266/web/blackbams-blog/wp-content/themes/SilentWoodsByBlackbam/single.php on line 75 internal_server_error <![CDATA[WordPress &rsaquo; Error]]> 500