As documented here: https://codex.wordpress.org/Function_Reference/post_class#Add_Classes_By_Filters
You can add a hook to the 'post_class'
filter to add/remove classes in the array passed. You can use the various template tags like has_post_format()
and others to see what classes you need to add; you’ll have access to the ID of the post in question.
You could erase the array entire and start fresh if you wanted, though it may have unforeseen side effects depending on what classes your stylesheet uses.
function rewrite_post_class( $classes, $class, $post_id ) {
// Add a class
$classes[] = 'my-custom-class';
// Remove a class
if ( $index = array_search( 'unwanted-class', $classes ) ) {
unset( $classes[ $index ] );
}
// Start over
$classes = array( $class );
$classes[] = get_post_type( $post_id );
}
add_filter( 'post_class', 'rewrite_post_class', 10, 3 );