Hi Jullian,
That is very much possible with a little bit of code.
Create the file: wp-content/plugins/dfi-catagory-images.php
Add the following code to that file, and change the category slugs and set the correct media/image ids:
<?php
/**
* Plugin Name: Default Featured Image, different images per category
* Plugin URI: https://www.ads-software.com/support/topic/different-feature-images-for-different-post-categories/
* Version: 1.0
*/
function dfi_category ( $dfi_id, $post_id ) {
// The category slug change per category.
if ( has_category( 'cat', $post_id ) ) {
return 7; // cat img id.
} elseif ( has_category( 'dog', $post_id ) ) {
return 8; // dog img id.
} elseif ( has_category( 'fish', $post_id ) ) {
return 9; // fish img id.
} elseif ( has_category( 'chicken', $post_id ) ) {
return 10; // chicken img id.
} elseif ( has_category( 'rhino', $post_id ) ) {
return 11; // rhino img id.
} elseif ( has_category( 'pikachu', $post_id ) ) {
return 12; // pikachu img id.
} elseif ( has_category( 'snail', $post_id ) ) {
return 13; // snail img id.
}
return $dfi_id; // the original featured image id.
}
add_filter( 'dfi_thumbnail_id', 'dfi_category', 10, 2 );
Don’t forget the activate the plugin after creating it.
Let me know how it goes!
Jan-Willem