admin管理员组文章数量:1208155
How can I hide a div (which contains an image) for a specific WordPress page?
I believe my page id is 46:
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"/>
</div>
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?
How can I hide a div (which contains an image) for a specific WordPress page?
I believe my page id is 46:
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"/>
</div>
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 asked Jul 23, 2013 at 15:17 David TunnellDavid Tunnell 4412 gold badges5 silver badges9 bronze badges 3 |6 Answers
Reset to default 2Guess 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') ) { ?>
<style>
#static-footer-image{
display: none;
}
</style>
<?php } ?>
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.
If that's the page ID, the selector should be
body#page-id-46 #static-footer-image
not
body.page-id-46 #static-footer-image
You may have a display
in CSS so you may try:
body.page-id-46 #static-footer-image {
display: none !important;
}
This works for me:
body .page-id-46 #static-footer-image {
display: none;
}
not this:
body.page-id-46 #static-footer-image {
display: none;
}
After body give a space and type .page-id-46 #static-footer-image{display: none;}
Once again check whether it's a class or id.
in my case, it's an id, here is my code for your reference:
body #post-448 .entry-meta-bar
{
display:none;
}
Hope this will help you.
How would the code look if you wanted to exclude a widget?
The CSS:
body.page-id-60748,
.widget_its-single-post {
display: none !important;
}
本文标签: theme developmentHide a div that is part of all pages on one specific page
版权声明:本文标题:theme development - Hide a div that is part of all pages on one specific page 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738698921a2107534.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
body
is not a child of#static-footer-image
, it should bebody.page-id-46 #static-footer-image
– Milo Commented Jul 23, 2013 at 15:21