Title: header.php and mobile detect
Last modified: August 21, 2016

---

# header.php and mobile detect

 *  [jasamizosijeka](https://wordpress.org/support/users/jasamizosijeka/)
 * (@jasamizosijeka)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/headerphp-and-mobile-detect/)
 * Hello,
 * it is about header.php
    i am trying to show this two divs ( with rest ofcourse)
   on just computers ( not phone or tablets) here is my code
 *     ```
       <div id="pozadinadesno" style="background:url('http://www.psc-osijek.hr/slike/manja.jpg');height:854px;width:277px;float:left;left : 50%; margin-left: -765px;margin-top : 152px; position:absolute ">
       </div>
       <div id="pozadinadesnije" style="background:url('http://www.psc-osijek.hr/slike/manja.jpg');height:854px;width:277px;float:left;left : 50%; margin-left: 488px;margin-top : 152px; position : absolute">
       </div>
       ```
   
 * when i change it
    to
 * `
    <?php include ‘wp-mobile-detect/mobile-detect.php’; if (function_exists(‘wpmd_is_phone’)&&
   wpmd_is_phone()) { } else { <div id=”pozadinadesno” style=”background:url(‘[http://www.psc-osijek.hr/slike/manja.jpg&#8217](http://www.psc-osijek.hr/slike/manja.jpg&#8217););
   height:854px;width:277px;float:left;left : 50%; margin-left: -765px;margin-top:
   152px; position:absolute “> </div> <div id=”pozadinadesnije” style=”background:
   url(‘[http://www.psc-osijek.hr/slike/manja.jpg&#8217](http://www.psc-osijek.hr/slike/manja.jpg&#8217););
   height:854px;width:277px;float:left;left : 50%; margin-left: 488px;margin-top:
   152px; position : absolute”> </div> } ?>
 * it shows arse error: syntax error, unexpected ‘<‘ ….
 * hmmm?
 * [http://wordpress.org/plugins/wp-mobile-detect/](http://wordpress.org/plugins/wp-mobile-detect/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [jasamizosijeka](https://wordpress.org/support/users/jasamizosijeka/)
 * (@jasamizosijeka)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/headerphp-and-mobile-detect/#post-3960111)
 * and if i put just this line of code
 *     ```
       if (function_exists('wpmd_is_phone') && wpmd_is_phone()) { echo ""; }
       ```
   
 * web page loads but shows that line of code ( , like it is not recognized… )
 * newb 🙁
 *  Thread Starter [jasamizosijeka](https://wordpress.org/support/users/jasamizosijeka/)
 * (@jasamizosijeka)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/headerphp-and-mobile-detect/#post-3960119)
 *     ```
       <?php if (function_exists('wpmd_is_phone') && wpmd_is_phone()) { echo "mobitel"; }
       else {
       echo "desktop";
       }
       ?>
       ```
   
 * i inserted this into header.php …
    now it works like it echo’s mobitel // desktop,
   it works ok …. but how to insert divs into this if statement :S
 *  [maheksiddique](https://wordpress.org/support/users/maheksiddique/)
 * (@maheksiddique)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/headerphp-and-mobile-detect/#post-3960315)
 * I guess first you have to detect the user device and then you can detect the 
   browser after that try to change your code accordingly.
    Read [ create mobile compatible website](http://www.ssiddique.info/create-mobile-compatible-website.html)
   for more details

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘header.php and mobile detect’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-mobile-detect.svg)
 * [WP Mobile Detect](https://wordpress.org/plugins/wp-mobile-detect/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-mobile-detect/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-mobile-detect/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-mobile-detect/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-mobile-detect/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-mobile-detect/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [maheksiddique](https://wordpress.org/support/users/maheksiddique/)
 * Last activity: [11 years, 11 months ago](https://wordpress.org/support/topic/headerphp-and-mobile-detect/#post-3960315)
 * Status: not resolved