Changeset 4608
- Timestamp:
- 01/05/2017 11:10:51 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/handbooks.php
r4341 r4608 46 46 47 47 add_filter( 'the_content', array( __CLASS__, 'autolink_credits' ) ); 48 49 // Add class to REST API handbook reference pages. 50 add_filter( 'body_class', array( __CLASS__, 'add_rest_api_handbook_reference_class' ) ); 48 51 49 52 // Add the handbook's 'Watch' action link. … … 229 232 } 230 233 234 /** 235 * Adds class to REST API handbook reference sub-pages. 236 * 237 * Due to special formatting of particular pages in the REST API handbook, a 238 * class is needed to target CSS rules. 239 * 240 * @param array $classes Body classes. 241 * @return array 242 */ 243 public static function add_rest_api_handbook_reference_class( $classes ) { 244 if ( 245 is_single() 246 && 247 'rest-api-handbook' === get_query_var( 'current_handbook' ) 248 && 249 ( ( $parent = wp_get_post_parent_id( get_the_ID() ) ) && ( 'reference' === get_post( $parent )->post_name ) ) 250 ) { 251 $classes[] = 'rest-api-handbook-reference'; 252 } 253 254 return $classes; 255 } 256 231 257 } // Devhub_Handbooks 232 258
Note: See TracChangeset
for help on using the changeset viewer.