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.