page_css_class

Filters the list of CSS classes to include with each page item in the list.

Description

apply_filters( 'page_css_class', (unknown) $css_class, (unknown) $page, (unknown) $depth, (unknown) $args, (unknown) $current_page ); 

Parameters (5)

0. $css_class (unknown)
The css class.
1. $page (unknown)
The page.
2. $depth (unknown)
The depth.
3. $args (unknown)
The args.
4. $current_page (unknown)
The current page.

Usage

To run the hook, copy the example below.
  1. $css_class = apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page ); 
  2.  
  3. if ( !empty( $css_class ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the page_css_class callback 
  2. function filter_page_css_class( $css_class, $page, $depth, $args, $current_page ) { 
  3. // make filter magic happen here... 
  4. return $css_class
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'page_css_class', 'filter_page_css_class', 10, 5 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'page_css_class', 'filter_page_css_class', 10, 5 ); 

Defined (1)

The filter is defined in the following location(s).

/core/menu/default_menu_walker.php  
  1. $css_class = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page ) );