function wpb_hidetitle_class($classes) { if ( is_single() || is_page() ) : $classes[] = 'hidetitle'; return $classes; endif; return $classes; } add_filter('post_class', 'wpb_hidetitle_class');