Advertisement
BakerMan

Replace .singular with .archive for event archives

Aug 12th, 2013
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.49 KB | None | 0 0
  1.  
  2. /**
  3.  * Remove .singular and replace with .archive for Event archives
  4.  */
  5. function use_archive_body_class_for_event_pages(array $classes) {
  6.     $remove = false;
  7.  
  8.     if (in_array('events-archive', $classes) && in_array('singular', $classes)) {
  9.         foreach ($classes as $key => $class) if ('singular' === $class) $remove = $key;
  10.         if ($remove) unset($classes[$remove]);
  11.         $classes[] = 'archive';
  12.     }
  13.    
  14.     return $classes;
  15. }
  16.  
  17. add_filter('body_class', 'use_archive_body_class_for_event_pages', 20);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement