This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Inject WPtouch scripts

By: brasofilo on May 12th, 2012  |  syntax: PHP  |  size: 0.61 KB  |  views: 249  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.  
  3. add_action('init', 'process_my_wptouch');
  4.  
  5. function process_my_wptouch(){
  6.         if (function_exists('bnc_wptouch_is_mobile')) {
  7.                 if(bnc_wptouch_is_mobile()) {
  8.                         add_action('wp_head', 'insert_my_wptouch_scripts');
  9.                 }
  10.         }
  11. }
  12.  
  13. function insert_my_wptouch_scripts() {
  14.         echo <<<HTML
  15. <style type="text/css">
  16.         body {background:url('http://www.example.com/wp-content/uploads/pattern.png') fixed !important;}
  17. </style>
  18. <script type="text/javascript">
  19. jQuery(document).ready( function($) {
  20.         $("div.content").prepend('<div style="margin-left: 13px;"><h4>Site Description</h4></div>');
  21. });
  22. </script>
  23. HTML;
  24. }
clone this paste RAW Paste Data