Hi @mian117,
Making changes to plugin’s code (or to a third-party theme) is not a good WordPress development practice: the next time you update the plugin WordPress will replace your modified plugin files with the stock ones automatically, undoing all of your plugin modifications.
Instead, please use the built-in hooks that the plugin provides so you can make changes to it without having to modify its code – like so for example:
<?php
/**
* Renders an alternative thumbnail from a custom field
* if the post doesn't have a thumbnail.
*
* @author Hector Cabrera
* @see https://www.ads-software.com/support/topic/multiple-custom-fields-10/
*
* @param string $img_url The default 'No thumbnail' image URL
* @return string $img_url The (modified) 'No thumbnail' image URL
*/
function wpp_thumbnail_fallback( $img_url, $post_id ) {
// Post doesn't have a thumbnail so let's fallback
// to the custom field one
if ( ! has_post_thumbnail( $post_id ) ) {
// Get the image URL from your custom field here
// and then assign it to $img_url or return your URL
//
// eg. $img_url = get_post_meta( $post_id, 'MY_CUSTOM_FIELD_IMG_URL', true );
}
return $img_url;
}
add_filter( 'wpp_default_thumbnail_url', 'wpp_thumbnail_fallback', 10, 2 );
If you have any other questions don’t hesitate to ask, ok?