• Hello,

    Trying to hide a heading if the condition is that two other areas of text are also hidden (id v4option and class v4type). Both these must be hidden together i.e. not only one or the other.

    <?php
    if ( #v4option, .v4type (‘display: none’)) {
    ?>
    <style>
    #v4heading{
    display: none;
    }
    </style>
    <?php } ?>

    [Moderator note: code fixed. Please wrap code in the backtick character or use the code button.]

    thanks!

    • This topic was modified 7 years, 7 months ago by bdbrown.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    Whatever event is causing the other areas to be hidden should also set the heading to be hidden at the same time. This is generally done with JavaScript or jQuery. CSS is very limited in its ability to apply logic. PHP generally doesn’t work because the conditions determining what should be hidden are not known server side.

    Thread Starter ratamatcat

    (@ratamatcat)

    hi yep I was unable to place this in the ‘else’ section due to it needing to use the condition of “both” as explained because the heading was becoming hidden when I wanted it visible in one of the cases. But reading your reply has helped because I have decided to go with some paid customization for a related page that covers the naming/labelling of the items and therefore allows me to remove altogether the need to show as much content in the page I’ve been trying to make work.

    It’s cathartic to select blocks of code and simply hit delete!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘hide a heading with CSS based on 2 conditions’ is closed to new replies.