Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Add custom class to post
// Add custom post class to posts
add_filter('post_class', 'wpstudio_custom_post_class');
function wpstudio_custom_post_class($classes) {
$new_class = 'brick';
$classes[] = esc_attr(sanitize_html_class($new_class));
return $classes;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment