Advertisement
Guest User

Untitled

a guest
May 19th, 2012
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1. /*
  2. This function checks how long it is since the blog was last updated
  3. */
  4.  
  5. function rob_get_blog_last_update(){
  6. global $wpdb;
  7. $newest = $wpdb->get_row("select post_modified from $wpdb->posts
  8. where post_type in ('page', 'post') and post_status = 'publish' order by post_modified desc");
  9. //echo mysql2date('d/m/Y',$newest->post_modified);
  10. //print_r($newest);
  11.  
  12. return($newest->post_modified);
  13.  
  14. }
  15.  
  16.  
  17. /*
  18. This function checks if you should show the add or not
  19. */
  20.  
  21. function rob_display_old_blog_ads(){
  22.  
  23. $checktime = date("Y-m-d H:i:s",time()-2592000);  // How many seconds old the blog has to be
  24. $updatedtime = rob_get_blog_last_update();
  25. //echo "<!-- Updated:". $updatedtime." check: ".$checktime."-->";
  26.  
  27. global $blog_id;
  28.  
  29.  
  30.  
  31. if($updatedtime < $checktime){
  32. //    echo "<!-- true -->"; // Show add
  33.     return true;
  34.   }else{
  35. //    echo "<!-- false -->"; // Don't show add
  36.     return false;
  37.   }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement