Advertisement
daymobrew

WordPress shortcode - Hide content on Monday

May 12th, 2015
712
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.49 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4. Plugin Name: Hide On Monday
  5. Plugin URI: http://www.damiencarbery.com
  6. Description: Hide the content on Monday.
  7. Author: Damien Carbery
  8. Version: 0.1
  9.  
  10. */
  11.  
  12. add_shortcode('hide-on-monday', 'sc_hom');
  13.  
  14. function sc_hom($atts, $content, $code) {
  15.     define('tm_wday', 6);  // Defines for code readability
  16.     define('monday', 1);
  17.     $localtime = localtime();
  18.     if(monday == $localtime[tm_wday]) {  // or: if(1 == $localtime[6])
  19.         return '';
  20.     }
  21.  
  22.     return $content;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement