brasofilo

Inject WPtouch scripts

May 12th, 2012
371
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data