How to show rev slider for mobile if device is mobile.

Hi,

I have found the code below which is suppose to be able to do the above:

<?php if ( wp_is_mobile() ) : ?>
    <?php putRevSlider("youraliasformobile") ?>
<?php else : ?>
    <?php putRevSlider("youraliasfordesktop") ?>
<?php endif; ?>

Which file do I put the above code if I'm using Be Theme?

Thank you for your time.


SY Lim.


Comments

  • Hi,

    it's functions/theme-functions.php file. But please remember that all theme modifications you do at your own risk.

    Thanks!
  • Thanks!
  • Hi,

    I've checked the above file but I can't seem to find the place to place it. Could you tell me where? Basically, I have made 2 rev sliders.  I want to load the 1st one by default but if the orientation is "portrait", I would like to load the 2nd slider.  How do you do that in Be Theme?  

    Thank you for your time.


    SY Lim.

  • Hi,

    I have found the code below in theme-functions.php:
    // Revolution Slider
    $slider = '// Revolution Slider ...

    I should change it to

    $slider = '<div class...>
    $slider .= '<?php if ( wp_is_mobile() ) : ?> .... rest of code...';
    $slider .= '</div>';

    Is that correct? I realize doing this will hardcode the sliders in the site. There is no other better way yes?

    Thank you for your time.


    SY Lim.

  • Hrm... it didn't work. Maybe it's because I was using the revslider in the page settings and not inserting them into the page via add item. (muffin builder allows me to set a slider inside the page settings).


    Could you help?

    Thank you for your time.

    SY Lim.
  • Actually, I just want to hardcode the slider for my homepage only. I wanted to add the php code that can will load the 2nd slider if its a mobile.  Is there a place where I can safely do that without affecting the whole site?

    Thanks again.

    SY Lim.
  • This can be done in functions/theme-functions.php file but please notice that we do not offer any files modifications. Also please remember that all files changes you do at your own risk.

    Thanks for understanding!
  • Hi, I've tried but nothing I did to theme-functions.php seemed to do anything.

    1.  I copied a copy of the above file into the BeTheme-Child/functions folder
    2.  I located function mfn_slider and added the code into revolution slider section.

    Nothing happened.  I've even remove the whole section on rev slider. Still nothing happened. This is the ONLY thing that is stopping my client from signing off the site.  Please help.  

    Thanks.

    SY Lim.

  • As we wrote above, we do not offer files modifications and all modifications must be done by web developer site. If you are not able to do it, you must play with options that are included into theme only.
Sign In or Register to comment.
This website uses cookies

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you’ve provided to them or that they’ve collected from your use of their services.

Cookies are small text files that can be used by websites to make a user's experience more efficient.

The law states that we can store cookies on your device if they are strictly necessary for the operation of this site. For all other types of cookies we need your permission. This means that cookies which are categorized as necessary, are processed based on GDPR Art. 6 (1) (f). All other cookies, meaning those from the categories preferences and marketing, are processed based on GDPR Art. 6 (1) (a) GDPR.

This site uses different types of cookies. Some cookies are placed by third party services that appear on our pages.

You can at any time change or withdraw your consent from the Cookie Declaration on our website.

Learn more about who we are, how you can contact us and how we process personal data in our Privacy Policy.

Please state your consent ID and date when you contact us regarding your consent.