Guus
Guus

Reputation: 11

Hiding a PHP element using css (WordPress)

I'm working on a website for a friend, everything goes well so far, but there's one little thing I can't seem to figure out. I have included SmartSlider 2, which I want to hide on mobile devices. But since SS2 doesn't natively support this I tried by editing the code. Long story short, it won't work.

I've tried including the CSS in the file itself (header.php) :

<div class="slider" style="@media(max-width:1120px;){.slider {display:none;}}">
<?php echo do_shortcode('[smartslider2 slider="2"]'); ?>
</div>

For some reason, it still shows up, hopefully you guys can help me out. Thanks in advance.

Upvotes: 0

Views: 50

Answers (1)

Shehary
Shehary

Reputation: 9992

It will not work like you are trying.

you have to put this in custom css

@media screen and (max-width: 1120px) {
    .slider {
        display:none;
    }
}

and remove from here

<div class="slider">
    <?php echo do_shortcode('[smartslider2 slider="2"]'); ?>
</div>

and in media query CSS you have ; here @media(max-width:1120px; it's wrong

Fiddle

Upvotes: 2

Related Questions