Advertisement
BakerMan

Remove sidebar, supporting snippet for body class

Sep 30th, 2013
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.60 KB | None | 0 0
  1. add_filter('body_class', 'remove_sidebar_class_for_month_view', 50);
  2.  
  3. /**
  4.  * Remove the .sidebar body class from month view.
  5.  */
  6. function remove_sidebar_class_for_month_view(array $classes) {
  7.     // Don't interfere if the request does not relate to month view
  8.     if (false === (tribe_is_event_query() && tribe_is_month())) return $classes;
  9.     $match = false;
  10.  
  11.     // Search for a match
  12.     foreach ($classes as $index => $class)
  13.         if ('sidebar' === $class) {
  14.             $match = $index;
  15.             break;
  16.         }
  17.  
  18.     // If we found the .sidebar class then remove it
  19.     if (false !== $match) unset($classes[$match]);
  20.     return $classes;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement