Last active
July 2, 2017 12:18
-
-
Save miklb/1a0276d511dcefc44f42515714460028 to your computer and use it in GitHub Desktop.
function to add h-entry to post class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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