Support » Plugins and Hacks » Hacks » static image header on some pages

static image header on some pages

  • Hello I wanted to ask you a question about the images in the headers. I put in a situation I have several images in the header which change randomly. In some pages I wanted them to be fixed and will not change. Can you do what I have in mind? Can you give me any recommendation as to if you could? Greetings and thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Sure you can!

    Exactly how would depend on how your header images are currently retrieved. For example, you could use a select/case structure where each case is a post ID that outputs a specific image path. The default case would then output the random image the same way as is done currently.

    Where would have to put the path of the image in the header file or function? You can give me an example to do me an idea of ​​how to do it. Thanks for your time.

    Where ever you want the image to appear in header.php might look something like this (I had the wrong language in my mind when I said select/case, it’s switch/case):

    <img src="<?php
       if (is_singular()){
          switch $post->ID {
          case 22:
             echo "http://example.com/wp-content/uploads/2014/3/image22.jpg;
          case 69:
             echo "http://example.com/wp-content/uploads/2014/3/image69.jpg;
       } else {

    thanks for replying I will study the code and try to implement on my website. regards

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘static image header on some pages’ is closed to new replies.