vendredi 3 novembre 2017

PHP How to combine is.mobile() and is_front_page()?

Within a client Wordpress site, I want to display a choice of two revolution sliders depending whether the user is viewing on a computer or device. For this, I got the following to work fine:

<?php if ( wp_is_mobile() ): ?>
    <?php putRevSlider("home-mob") ?>
<?php else : ?>
    <?php putRevSlider("home") ?>
<?php endif; ?>

So home slider is displayed on a laptop/desktop and the home-mob slider on a tablet/phone.

My question now being, how do I combine this with is_front_page() in order to only have the choice of slider appearing on the home (front) page, and not on any other page? Reason being is because the above PHP code is on my header.php file so it's currently displaying on all pages.

I've tried using a double ampersand inbetween them both in a few ways but to no avail. Any help would be appreciated! Thanks.

Aucun commentaire:

Enregistrer un commentaire