added exclude post_formats
-
Thank you very much for this great plugin.
Instead of excluding post_types, I wanted to exclude some post formats (especially, the “video” format, because I want the video to be seen in the feed, not the featured image).
So, in function easy_add_thumbnail, I added :
$post_format = get_post_format( $post->ID ); $exclude_formats = array( '' ); $exclude_formats = apply_filters( 'eat_exclude_formats', $exclude_formats );
and I replaced
if ( ! in_array( $post_type, $exclude_types, true )) {
by
if ( ! in_array( $post_type, $exclude_types, true ) && ! in_array( $post_format, $exclude_formats, true ) ) {
In my child_theme functions.php I included an adaptation of your FAQ code:
//Easy Add Thumbnail: exclude post formats from adding a featured image add_filter ('eat_exclude_formats', 'my_excluded_formats', 10, 1); function my_excluded_formats ( $exclude_formats ){ $exclude_formats[] = 'video'; return $exclude_formats; }
As far as I have tested, it seems to work.
Maybe something that could be included in a future release.thanks again for your great work.
Fran?ois
- The topic ‘added exclude post_formats’ is closed to new replies.