Thursday, May 26, 2011

Wordpress and Twenty Ten Header Image Bug Fixed!

Houston we have a problem! There is a bug whereby randomly the header image changes to be an image from the item or post that you are currently viewing. What causes it is some code in Twenty Ten that looks for an image that has the same dimensions as your header image. If it finds one it will then make that into the header image.

The solution is to edit the Twenty Ten Header file (header.php) to remove the entire PHP IF, ELSE and ENDIF statement as can be seen in the image below. With this modification the header image will not change from the one that you have set up as your header image.


On the other hand if you want to take advantage of this code you just need to make images the same size as your header and include them in your post. Actually for some reason that sometimes happens because every now and then it crops the image to be the right size. I have not yet determined why that happens.

No comments: