exclude a class from the_content in wordpress in a template page

I’ve a output template ( from some product research), using the_content() of a page.
I’d like to exclude one class from the_content() (which is from a page using Default template).

I’ve seen it was possible using a function, but how to realize it? I’ve only found to exclude shortcode which I’m not looking to do . . .

Read More

thank you in advance 🙂

Related posts

Leave a Reply

1 comment

  1. Open up your header.php file. Right before the closing </head> tag you’ll want to include the following code.

    <script type="text/javascript">
        jQuery(document).ready(function() {
            // change .yourClassName to the actual class you want to remove.
            jQuery('.yourClassName').remove();
        });
    </script>
    

    Alternatively you could use a conditional PHP statement wrapped around some CSS inside the <head></head> tags to hide it. Again, you would do this in the header.php file. Using the conditional statement you could tell the CSS to only work on a specific page and not affect any other pages. See below.

    <?php if (is_page(1)) { ?> 
        <style type="text/css">
            /* change .yourClassName to the actual class you want to hide. */
            .yourClassName {display:none;}
        </style>
    <?php } ?>
    

    If you go the CSS route, you would set the page ID of the page you want the CSS to affect by changing the number 1 inside of is_page(1) to the appropriate page ID. You could also use the page slug, so in place of the number 1 you could use 'your-page-slug'. You can read up on the is_page() function here.

    Hopefully this helps.