Add class to post_class
-
I am looking to write a function that detects if a feature image has been added to a post, and to add a class if it has. I have written this so far.
// Add a class to post_class if feature image is detected function check_image( $class ) { if ( has_post_thumbnail() ) { $class[] = 'feature-image'; } return $class; } add_filter('post_class', 'check_image'); // end ---
This actually works but I am getting an error “Missing argument 1 for check_image()”. Any ideas?? I am quite new to writing WordPress functions so go easy ??
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Add class to post_class’ is closed to new replies.