Snippet for | WordPress.org

[ad_1]

Hello,
thank you very much for the update of the plugin – and compatibility with WP 6.2.
Just one question – we just want default images only for postings, not for other cpt. So we use the Snippet below in our theme’s function.php:

/**
 * Fallback Featured Image only for postings
 */
function theme_slug_default_featured_image( $dfi_thumbnail_id, $post_id )
{
	$post = get_post( $post_id );

	// Show default featured image only on blog posts
	if ( 'post' === $post->post_type ) {
		return $dfi_thumbnail_id;
	}

	// Return invalid Image ID
	return 0;
}

Will this code still work with the latest version 1.7.3 or do we have to change the snippet? If so – could you please tell me, what to change?

Thanks in advance and have a great day!
Manuel

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer