• Hi there,

    It seems that I have a conflict with wp_is_mobile function and my theme which is OneStudio.

    I would like that some parts appear only in the mobile version, that’s why I want to use this function. But nothing happens ??

    Here is an example of my code (in case of I haven’t programmed it correctly):

    if ( wp_is_mobile() ) { ?>
    						<header id="logo" class="col grid2<?php if(empty($smof_data['custom_logo'])) echo ' text-version'; if(!empty($smof_data['hide_header_menu'])) echo ' no-menu'; if(!empty($smof_data['logo_expand'])) echo ' expand'; ?>">
    		</header>
    				<?php  }    ?>

    I tried plugins that propose the same kind of option. Same result = no result.

    I precise that other conditional tags like if(is_page(‘mypage’)) work.

    There’s no installed plugin on my site.

    I tried to contact the theme author…he says that there is no problem between his theme and the function, which isn’t true.

    I am sure that there’s a function from the theme blocking the mobile detection function.

    How can I see that and solve this issue ?

    Thanks for your reply

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter onirisweb

    (@onirisweb)

    I can provide a demo : https://sagi-boutique.com/faqs/

    If you watch the site on mobile, the small logo as it is in the desktop version should be shifted by a bigger one wrapped on a blue background. A button that expands the menu should appear on the bottom of this blue block. In fact, the logo render should be exactly the same as it is for the home page.

    Where did you download this theme from?

    Thread Starter onirisweb

    (@onirisweb)

    Themeforest. I also posted on the comments sections, but no positive answer.

    I’m sorry but as you appear to be using a commercial theme, you need to seek support from the theme’s developer/vendor. We do not support commercial products here.

    Thread Starter onirisweb

    (@onirisweb)

    As I already said, I tried to contact him several times, but every times he answers out of the subject.

    I precise that I don’t look for somebody that will make all the work at my own place. I’m looking for suggestions to solve this issue.

    For example, is there any php function for debugging and clear any conflict ?

    You could try turning debug on and enabling error logging but that’s all that WP can offer itself.

    Moderator bcworkz

    (@bcworkz)

    There isn’t much a theme could do to corrupt wp_is_mobile() other than corrupt one of the variables it uses to make a decision. The function is not fool proof. It essentially does a keyword search on the user agent string sent by most browsers. If the agent string from your mobile device is lacking any of these keywords, the check will erroneously return false.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘wp_is_mobile doesn't work with my theme’ is closed to new replies.