Wordpress random header plugin

What is it?

This plugin allows you to add a random header image to the top of your website.

No PHP knowledge is neccessary to implement it into your site. Just upload all files to your plugin directory and activate it in the admin section of your site. Configuration is also done via the Wordpress admin section.

Screenshot admin section

Installation

  1. Download the zipped plugin file and save it somewhere on your computer.
  2. Unzip this file and upload all the files+directory to the wp-content/plugins directory.
  3. Login to your Wordpress admin section and go to the plugins page
  4. In the list on the plugins page find the Random header entry en click the Activate link.
    If the Random header entry doesn’t show up make sure all the files where uploaded and into the correct directory.
  5. All images used by this plugin need to be stored in a subdirectory images in your theme directory. For the default theme this should look something like this wp-content/themes/default/images. Upload all different images you have to this directory.
  6. Go to the options > Random header page to configure the plugin.
  7. That’s it your done.

What if it doesn’t work?

If you’ve installed this plugin and it doesn’t work these are some pointers to get it working.

  • Is the plugin in the admin plugins list?
    Make sure you uploaded it to the correct directory this is in general wp-content\plugins. Also make sure the directory randomheader is located here.
     
  • Is the plugin activated?
    Check the plugins list in your admin section and make sure it’s activated. If not click the activate link.
     
  • Is there a ‘Random header’ tab under options?
    If not check the points above.
     
  • Which theme are you using?
    This plugin was tested with the default Wordpress theme which contains all neccessary code for it to work. If the wp_head programming hook wasn’t included in your theme file this plugin might not work. Check this by selecting the default theme. If the headers show up you need to modify your theme files to include the wp_head hook.
     
  • Does the html code contain the ID tag you supplied?
    View the source of a page and check if the id attribute is somewhere in it. If this isn’t the case either modify the name on the options page or edit your theme file to include it (preferably somewhere in the header.php theme file).
     

47 Responses to “Wordpress random header plugin”

  1. Tijd Says:

    Oh how good. I like the image you use. I’ve been looking for something similar, since I don’t us WordPress.

  2. Dan Says:

    Hey!

    Great plugin you’ve made :) i’m sure i’ll be using someday when i get tired of my header. :P Good work.

    By the way i usual come here as you provide some good wordpress plugins (like the spread firefox one) so i’ve added you to my site links.

    Though as my site is very new i would hope that you could add an text link of my site in your links page… Of course that if you see any problem with it say so.

    Thanks…

  3. James Says:

    Fantastic simple plugin, just what I needed. If you ever do another version, it would be cool to be able to force a certain header image to display via an URL variable i.e. index.php?cat=12&force_header=3 or something.

    I know this somewhat defeats the object would it be a handy option nonetheless. Cheers, James.

  4. Marc Says:

    installed the plug-in. cannot add any images. I get the choose image pull down, but no window pops up to allow me to select a file. Any ideas?

  5. James Says:

    Hmm. Found a bug today/feature today. If you select add image, without chosing one from the dropdown, it’ll add a null image which will give you a blank space in the random rotation. Easy to spot really. Just thought I’d mention it. Cheers, James.

  6. jhonnyt Says:

    Good Joob, Today it´s more simple change the image look congratulations

  7. JayJay Says:

    installing the plugin as you posted above or the in the archive readme-file i get the following error when looking up on my main blogpage:

    Warning: array_rand() [function.array-rand]: First argument has to be an array in /srv/www/htdocs/xxxxxxxx/xxxxxxx/xxxxxxxx/wp-content/plugins/randomheader.php on line 41

    hope you get gimme a hand mate! thanks in advance.

  8. Frankie Says:

    Unfortunately, mine isn’t working.

    When I click on options > Random header the link goes to

    ….wp-admin/randomheader/options.php which of course doesn’t exist.

    Any ideas why it’s pointing to this area?

  9. Kamiel Martinet Says:

    JayJay - Did you configure the plugin on the random header options page? It seems it returns an empty image array.

    Frankie - you could try changing the url in the randomheader.php page from ‘randomheader/options.php’ to something like ‘/wp-content/plugins/randomheader/options.php’. This could also be caused by a bug in wordpress.

  10. Rui Moura Says:

    Fantastic plugin :D … I’m using it right now ;)

  11. Les Says:

    Just found this through a link on the WordPress forums. This is something I’ve been thinking about doing for ages, so I just had to give it a try. And it works perfectly for me.

    Thanks :)

  12. Levy Says:

    Any ideas on how to make the random headers as links? I would like to have the whole image as a link to the homepage… Any help would be appreciated.

    Thanks!

  13. Vince Says:

    Hi, great plugin. But i have some problems when i want to add some new pictures. I can select them, but he never show them. It only work with the pictures from my theme.( wp-content/themes/relaxation_3column/images/) I working with the ‘Relaxation_3column 1.0.2′ theme. Can you help me?

  14. Greg Says:

    Hi There,

    Looks like a great plugin. I’m wondering how to simplify the process of selecting the random images to be displayed. I’ve made a directory within my theme called “randomimages” which I have filled with images. I’d like to use your script to automatically select from the directory rather than having to go through the admin options page to choose each image, one at a time. I’m new to php, and can’t figure out what I need to modify to bypass the “Choose an image” step, and have your plugin fetch a random image from the entire directory. Any suggestions are greatly appreciated.

    Thanks!

  15. Eduo Says:

    This is nice. I’ve been using a line of PHP code that defines the style: tag of the header DIV with a random number between 1 and 30 for mine and it worked somewhat acceptably, but I have to remember to move it whenever I change the theme.

    Something I’d been looking for is noot only the ability to change the header but the ability to attach a color theme to the chosen image, so that a greenish image also loads a greenish css color theme, and a blue-ish theme also loads a blue-ish color scheme.

    So far I’d been thinking of using the name of the picture. Images would have a leeter signifying the color scheme (for example b-clouds.jpg) and I’d chop the first character and define the color scheme using that character.

    Also, when considering this I also thought the frames of my images would have to match (currently the green frame from Connections is in all my images), which I’d probably try to rework using CSS.

    Have you thought of adding such an extension to your plug-in? It’d be neat.

    I thought of running my JPGs over a normalizer to pick up the average color and automatically generate a random matching palette for it but don’t know how it’d work.

    Eduo

  16. Mike Ernst Says:

    Great plug-in! I’ve implemented it on my site.

    Click here to witness it’s glory:
    http://www.magicalurbanism.com

  17. Fox Says:

    Great plug-in!

  18. Basti Says:

    jaer mega geil !

  19. fed Says:

    Even with the default theme I can not see my custom images. I have placed them in my wp-content/themes/default/images. Do they need to go in there own directory? Do the images have to be a certain size?

  20. fed Says:

    Also, what theme are you using for this site?

  21. troppmann Says:

    i am getting one of these….ideas?

    Fatal error: Call to undefined function: get_option() in /home/.latoya/leisurep/leisureproductions.com/blog/wp-admin/randomheader/options.php on line 27

  22. darwin Says:

    I have a problem… its not producing a random image, instead it shows only the latest uploaded picture

  23. Jim Says:

    I’ve noticed with my theme (Batavia 1.5 1.1) that the size of the header varies a bit whether it’s in mozilla or IE. This causes problems because the image tiles in IE. I’m not sure what the solution is. Any ideas?

  24. Jim Says:

    Hey, I found a way around the problem. Simply make the banner bigger. The bottom part won’t appear in Mozilla, and it will fill the space and not tile in IE.

    Now I’m happy. :-) But it’s good to be aware of. Great plugin, thanks!

  25. Arne Says:

    Hey,
    great plugin. Just installed and it even works fine with WP2.0

    Greets, Arne

  26. Anthony Says:

    I get the same error as JayJay, when I try to click into the options I get the message. I’m guessing its something to do with me running WP 2.0?

  27. Drew Slifer Says:

    Thank you so much for this plug-in, works perfectly!

  28. Benjamin Solah Says:

    Great Plugin. I recently implemented it on my blog. It works really well.

  29. B Says:

    Thank you so much for this plugin. I have tried several different methods and couldn’t get them to work. This worked perfectly on the first try!!!

    See it at http://www.beyondbee.net

  30. -bitMAN- Says:

    Woa!, It works great! Thanks a lot ;)

    About your error troppmann, you have to upload some files first at Options>Random Header. When you upload something (even if is only one header), then the error dissapear :D

    Ah!, almost forgot… it works perfectly with the new WordPress 2.0

  31. Enrique Says:

    Thanks for this! I was going to try to develop one on my own, but this is better…

  32. Oo Bubu Says:

    Hi Kamiel Martinet,

    Your idea of plugin is very interesting !!!

    I am using WordPress 2.0 and the skin Regulus (http://www.binarymoon.co.uk/2005/12/regulus-20/) and I’d to be able to use your plugin !!!

    But there is a problem !!!

    Everything is OK, uploaded in the correct folder, I can manage the plugin but in the website nothing happens !

    Is there any missing in my skin or header ? Or is it unsuitable for WordPress 2 ?

    Please advice !

    Best regards

    Hubert

  33. Jon Says:

    Hey great code, it worked the first time. I had tried another guy’s plugin, but I spend 30 minutes and never got it to work.

    Can you, or are you planning a version that would use images on other domain? Like Fickr.com?

    Thanks - Jon - EpicGuide.com

  34. Justin Says:

    Great plugin for a simple task that I am not smart enough to code myself! Thanks for doing the heavy lifting.

    I also ran into the “null image” thing that James mentioned. I can’t figure out how to remove this “null image” from the rotation. Just once in a while no image will load. The src indicates an image *should* be there, but it isnt. Very interesting. I’ve check the db to see if I can spot what to change to fix this, but no luck. Any suggestions from others would be appreciated.

  35. Melv Says:

    Hi.. Just installed the plugin. O.k. up to a point …then…when I want to add an image.. the drop-down menu is distorted and won’t show the image options. Using WP2. Any ideas?…thanx

  36. Maria Says:

    I have been using this for a short time and I love it. It works great with Connections, which I use.

    But I’m an idiot. I somehow managed to add an empty image to the queue of images. It doesn’t appear in the configuration screen, but every once in a while (randomly, in fact ;-) ) the header image doesn’t appear at all.

    Where are the URLs for the header image stored? How can I delete the empty record I somehow added?

  37. Lee-Roy Says:

    This seems really unfortunate… I can’t get this to work in Wordpress 2.0.1. At first, I thought it might be a problem with the them I was using (K2). Then I tried it with the default as suggested (which is Kubrick). Still nothing. The problem occurs when I try to click on the random header options tab. I keep getting 404’s and changing the url in the the plugin php doesn’t work either. There is also this error:

    Warning: array_rand(): First argument has to be an array in /home/.jeris/elarrr/blog.artandstory.com/wp-content/plugins/randomheader Folder/randomheader.php on line 41

    It looks like a really cool plugin :)
    Really wish someone could help with this. :(

    sigh

  38. Maria Says:

    I thought I posted a comment here, but with my luck, it was incorrectly identified as spam. I’ll try again.

    I somehow managed to add an empty image to the list of images for RandomHeader. I did this by clicking the Add Image button in the configuration screen without first selecting an image from the menu. (Duh.) This appears to have added an empty path SOMEWHERE in Random Header’s configuration files, although a blank image does not appear in the Config screen so I could delete it.

    The result of this stupidity (on my part) is that every once in a while (randomly, in fact ;-) ) a blank image appears in the header. I don’t want this to happen, but I can’t find the place where Random Header stores the image paths. Can SOMEONE please enlighten me?

    Also, other than this problem, I’m using Random Header successfully with WordPress 2.0 and the original Connections theme. Got 20 images rotating through the queue and my site visitors love it!

  39. anthony Says:

    when i go to the random header options i get this error Warning: array_rand() [function.array-rand]: First argument has to be an array in wordpress/wp-content/plugins/randomheader/randomheader.php on line 41 with my site below. i dont see the screen to add images or anything

  40. Anja Says:

    Unfortunately I have a similar error message like JayJay and Anthony:

    Warning: array_rand(): First argument has to be an array in /www/htdocs/xxxxxx/blog/wp-content/plugins/randomheader/randomheader.php on line 41.

    I use WP 2.0.1. I’m not sure, but I guess I don’t have the wp_head (my theme: “juicy”). What should I do?
    I appreciate your help! I designed a few headers by myself and your plugin is exactly something that I was looking for :)

    Thanks in advance, Anja

  41. Rob Doar Says:

    I also have regulus theme
    (http://www.binarymoon.co.uk/2005/12/regulus-20/)
    and when I configure the files, I have a 10-20px blank space, before the picture starts…. Any idea?

  42. Steve Says:

    I’ve got the plugin installed and the images display, but I would like to have them float right in the header div. I haven’t been able to get this to work properly; admittedly, I don’t fully understand the float property. I’ve tried a bunch of different variations, but no luck so far.

    Anyone have any ideas?

    You can view my style sheet here:

    http://americanliar.com/wp-content/themes/gila/style.css

    TIA for any help… will be out for a while, will check in later…

    steve

  43. Steve Says:

    PS: I disabled the plugin temporarily, so the header images won’t be displaying on the left behind the blog title and description…

    steve

  44. Glen Says:

    WP 2.0 same problem as above. Can someone get us any answer to solve this. I love this plugin and want to put it into action. thanks.

    Warning: array_rand(): First argument has to be an array in /home2/info/public_html/rvamerica/wp-content/plugins/randomheader.php on line 41

  45. Kevin M. Says:

    Great Plugin, incredibly easy to use! Thanks Kamiel!

  46. Jesse Says:

    This plugins is NOT doesn’t with Kubrick default template 1.5 I believe because the header style is totally different. I’m right ?
    I’m using WP 2.0.5 with Kubrick default template 1.5 and it does not.

  47. eduo Says:

    Hi!
    I just implemented your plug-in in lieu of a homegrown php solution I had made and it works perfectly (actually, it works exactly as my function, but now it’s much tidier).

    I’ve been thinking of changing a few things, mainly I’d like to change four of them:
    1.-Move the selection popup to the top of the screen, I just had to add 30 images and it got tiresome to scroll more and more with each image added.
    2.-I’d like to set the last image selected as the “SELECTED” one in the popup menu. This would also help remembering which one was the last.
    3.-For the same reason as above, I’d put the image added in the confirmation box.
    4.-For the same image, yet again, I’d put the image’s name below the image preview.

    Are you planning on doing any of these or would you consider it? Otherwise if you give me permission I’ll do it and post the link to the changed version here.