WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I hide a div (which contains an image) for a specific WordPress page?

I believe my page id is 46:

enter image description here

Here is the div I am trying to change:

<div id="static-footer-image" style="position:absolute; bottom: -15px; z-index: 501;">
    <img src="images/background-bottom.png"/>

And the associated CSS code in my main CSS file:

#static-footer-image body.page-id-46 { 
     display: none; 

It is still showing. What do I do to fix this?

share|improve this question
Your CSS rule is backwards, body is not a child of #static-footer-image, it should be body.page-id-46 #static-footer-image – Milo Jul 23 '13 at 15:21
thanks, but it is still showing. – David Tunnell Jul 23 '13 at 15:27
are you sure about the page id? inspect the body tag on rendered html code for that page and confirm please. – aldo.roman.nurena Jul 31 '13 at 5:58
up vote 2 down vote accepted

Guess from the URL structure, your %postname% permalink structure is active. So, a bit of internal CSS can help alternatively, and the syntax is in_page('page_slug'):

<?php // Do action only on specific page in WP ?>
<?php if( in_page('resourses') ) { ?>
      display: none;
<?php } ?>
share|improve this answer
this is adding unnecesary load to the server, I would go for M-R's answer – aldo.roman.nurena Jul 31 '13 at 5:54
I do agree. Sure, he's right. – Mayeenul Islam Jul 31 '13 at 10:04

Use following CSS

body.page-id-46 #static-footer-image { 
     display: none; 

and make sure "page-id-46" class is applied to body tag and Clear the cache. May be try on another browser or a incognito window.

share|improve this answer

If that's the page ID, the selector should be

body#page-id-46 #static-footer-image


body.page-id-46 #static-footer-image
share|improve this answer
nope, WP renders <body class="page page-id-28 page-template ..."> for me, so that's a class – aldo.roman.nurena Jul 31 '13 at 5:53

You may have a display:something in css so you may try

body.page-id-46 #static-footer-image { 
     display: none !important; 
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.