bbdev

Global Search undefined global post id fix

May 29th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.65 KB | None | 0 0
  1. <?php
  2. add_filter( 'body_class', 'bosschild_events_page_class', 9 );
  3. function bosschild_events_page_class( $classes ){
  4.     if( !function_exists( 'boss_events_page_class' ) )
  5.         return $classes;
  6.    
  7.     remove_filter( 'body_class', 'boss_events_page_class' );   
  8.    
  9.     global $post;
  10.     $events_page_id = get_option ( 'dbem_events_page' );
  11.        
  12.     if( isset( $post->ID ) && $post->ID == $events_page_id ) {
  13.         $classes[] = 'events-page';
  14.     }
  15.        
  16.     if( isset( $post->ID ) && $post->ID == $events_page_id && get_option('dbem_display_calendar_in_events_page')) {
  17.         $classes[] = 'fullcalendar-page';
  18.     }
  19.     return array_unique( $classes );
  20. }
Add Comment
Please, Sign In to add comment