mirror of
https://github.com/10h30/trestle.git
synced 2026-06-05 15:09:35 +09:00
Introduce trestle_post_classes to add custom classes to posts in certain situations
This commit is contained in:
@@ -315,6 +315,26 @@ function trestle_custom_nav_extras( $nav_items, stdClass $menu_args ) {
|
||||
* Posts & Pages
|
||||
===========================================*/
|
||||
|
||||
add_filter( 'post_class', 'trestle_post_classes' );
|
||||
/**
|
||||
* Add extra classes to posts in certain situations.
|
||||
*
|
||||
* @since 2.2.0
|
||||
*
|
||||
* @param array $classes Post classes.
|
||||
* @return array Updated post classes.
|
||||
*/
|
||||
function trestle_post_classes( $classes ) {
|
||||
|
||||
// If post doesn't have a featured image.
|
||||
if ( ! has_post_thumbnail() ) {
|
||||
$classes[] = 'no-featured-image';
|
||||
}
|
||||
|
||||
return $classes;
|
||||
|
||||
}
|
||||
|
||||
add_filter( 'wp_revisions_to_keep', 'trestle_update_revisions_number', 10, 2 );
|
||||
/**
|
||||
* Sets the number of post revisions.
|
||||
|
||||
Reference in New Issue
Block a user