| | 539 | /** Add child-theme-<Name> to default body classes */ |
| | 540 | if ( is_child_theme() ) { |
| | 541 | $active_theme_css_url = get_stylesheet_directory() . '/style.css'; |
| | 542 | $active_theme_data = get_theme_data( $active_theme_css_url ); |
| | 543 | // set Name to lower case |
| | 544 | $active_theme_slug = esc_attr( strtolower( $active_theme_data['Name'] ) ); |
| | 545 | // concatenate multiple word names by replacing spaces with hyphens |
| | 546 | $active_theme_slug = preg_replace( '/\s\s+/', ' ', $active_theme_slug ); |
| | 547 | $active_theme_slug = preg_replace( '/\\040/', '-', $active_theme_slug ); |
| | 548 | $classes[] = 'child-theme-' . $active_theme_slug; |
| | 549 | } |
| | 550 | |
| | 551 | /** Add theme-<Name> to default body classes */ |
| | 552 | $parent_theme_css_url = get_template_directory() . '/style.css'; |
| | 553 | $parent_theme_data = get_theme_data( $parent_theme_css_url ); |
| | 554 | // set Name to lower case |
| | 555 | $parent_theme_slug = esc_attr( strtolower( $parent_theme_data['Name'] ) ); |
| | 556 | // concatenate multiple word names by replacing spaces with hyphens |
| | 557 | $parent_theme_slug = preg_replace( '/\s\s+/', ' ', $parent_theme_slug ); |
| | 558 | $parent_theme_slug = preg_replace( '/\\040/', '-', $parent_theme_slug ); |
| | 559 | $classes[] = 'theme-' . $parent_theme_slug; |
| | 560 | |