Learning WordPress: header images

I have used the theme named Twenty Eleven for the Royal Palm Social Club web site because I liked having a series of banner images show in the header. I used various scenes from Royal Palm that swap out each time a page is selected. But what I didn’t like is that the images also showed up on the pages when a post was being shown, because the generic images do not relate to the post topic.

“Theme” in WordPress refers to group of programming files that describe how the elements of a web site work together as well as to how the site will look. There are literally thousands of possible themes to use, and WordPress makes it very easy to switch themes. In so doing, you can quickly and easily change the total appearance of a site.

I have done some digging several times over the last few months trying to learn how to solve this problem of header images, but with no success. Some themes use them, others do not, and I have not found a theme that works the way I want it to. Today I took advantage of some down time and dug a little further. And in so doing, I learned more about WordPress and the PHP programming language.

It turns out that all I had to do was slightly change the code in the header.php file to test for whether the current page requested was the home page or a site page and load image if so. That left only post pages and the image would not be loaded.

In solving this I had to learn how headers were handled in this theme and learn the PHP functions to determine whether a page was being loaded, and then add the code to ignore the header image if not.

I am pleased with my effort and progress!

Leave a Reply

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