javascript - Hide CSS class only in single post pages

admin2025-01-08  3

I need to hide some elements in my posts pages, but not in all the other normal pages. Now they appear in all my Wordpress site (single post, page, etc).

How can I hide by CSS an element? This element has a single class <div class="frame-content".

Can I do something like: if <post> then .frame-content{display:none;}?

I need to hide some elements in my posts pages, but not in all the other normal pages. Now they appear in all my Wordpress site (single post, page, etc).

How can I hide by CSS an element? This element has a single class <div class="frame-content".

Can I do something like: if <post> then .frame-content{display:none;}?

Share Improve this question edited Dec 27, 2018 at 9:36 Roberto Meijide asked Dec 27, 2018 at 8:53 Roberto MeijideRoberto Meijide 116 bronze badges 1
  • add css style in your style sheet .single .frame-content {display: none;} – suresh gadisetti Commented Dec 27, 2018 at 13:27
Add a comment  | 

2 Answers 2

Reset to default 0

This worked for me:

<?php if( is_single() ) : ?>
<style id="my-internal-css">
    .frame-content {
       display: none !important;
    }
</style>
<?php endif; ?>

You can use post specific classes related to body. for example:

body.single-post .frame-content{display:none;}
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736270058a1399.html

最新回复(0)