2

I am a CSS noob and completely PHP ignorant. I am trying to remove the header image from all pages except the homepage in WordPress.

I found this question & answer, but it is beyond my understanding, since I don't know any PHP. Referring to this question and to this one, in the css customizer I tried to add:

:not(.home) header-image {display: none;}

However, it does not work.

Note that this can be applied to any single page, not only the homepage. For instance with .page-id-123 instead of .home –– this also works, of course, if .page-id-123 is the homepage, whereas 123 is just a random page id here.

Question:

How to use the not selector :not() to exclude all pages except one from CSS customization?

sao
  • 1,835
  • 6
  • 21
  • 40
Will
  • 247
  • 1
  • 13

1 Answers1

1

You should use the :not selector like this to hide an element on all pages except homepage:

body:not(.home) .header-image {
display: none;
}
Andrey
  • 702
  • 1
  • 9
  • 22