When creating a custom WP theme, I try to add additional classes to the body tag if the user goes to the bonus or news page ( example.com/bonuses/ example.com/news/ ), (the page_bonuses and page_news , respectively), but for some reason nothing not happening.
function my_body_class_filter($classes) { if( is_single('bonuses') ){ $classes[] = 'page_bonuses'; }elseif (is_single('news') ){ $classes[] = 'page_news'; } return $classes; }; <body class="body" <?php body_class(add_filter('body_class', 'my_body_class_filter')); > What is wrong I prescribe in conditional tags?
