Skip to content

Instantly share code, notes, and snippets.

@miklb
Last active July 2, 2017 12:18
Show Gist options
  • Save miklb/1a0276d511dcefc44f42515714460028 to your computer and use it in GitHub Desktop.
Save miklb/1a0276d511dcefc44f42515714460028 to your computer and use it in GitHub Desktop.
function to add h-entry to post class
function my_post_classes( $classes ) {
$classes = array_diff( $classes, array( 'hentry' ) );
if ( 'page' !== get_post_type() ) {
// Adds a class for microformats v2
$classes[] = 'h-entry';
// add hentry to the same tag as h-entry
$classes[] = 'hentry';
}
return $classes;
}
add_filter( 'post_class', 'my_post_classes' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment