Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // add custom body class for dontpaniclabs.com
- add_filter( 'body_class', 'dpl_add_custom_body_class' );
- function dpl_add_custom_body_class( $classes ) {
- $classes[] = 'dpl';
- return $classes;
- }
- // https://sridharkatakam.com/add-page-slug-body-class-static-pages-wordpress/
- add_filter( 'body_class', 'dpl_body_class_for_pages' );
- /**
- * Adds a css class to the body element
- *
- * @param array $classes the current body classes
- * @return array $classes modified classes
- */
- function dpl_body_class_for_pages( $classes ) {
- if ( is_singular( 'page' ) ) {
- global $post;
- $classes[] = 'dpl-page-' . $post->post_name;
- }
- return $classes;
- }
Advertisement
Add Comment
Please, Sign In to add comment