Created
November 24, 2016 12:55
-
-
Save marcelotorres/0883eae35d042caf16b850d59a47eb39 to your computer and use it in GitHub Desktop.
Filter to put more classes in the body class function, in the example below you are adding the "post slug"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Filtro para colocar mais classes na função body class, no exmeplo abaixo está adicionando o "slug do post" | |
*/ | |
add_filter('body_class', 'body_classes_plus'); | |
function body_classes_plus($classes) { | |
global $post; | |
$classes[] = (!is_home()) ? $post->post_name : ''; // Slug do post | |
//$classes[] = 'anything else'; | |
return $classes; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment