Hide vendor profile image when no image is uploaded

Hi everybody, I want to hide the default profile image of the vendor if the vendor hasnt uploaded any image and show the image if he uploaded one? How can I do this?

Like: if current vendor profile image equal (default image name) then do this, else do this.

Regards

Please try this PHP code snippet.

add_filter('hivepress/v1/templates/vendor_view_block/blocks', 'change_vendor_image', 1000, 2);
add_filter('hivepress/v1/templates/vendor_view_page/blocks', 'change_vendor_image', 1000, 2);

function change_vendor_image($blocks, $template){
	$vendor = $template->get_context('vendor');
	
	if(!$vendor || $vendor->get_image__id()){
		return $blocks;
	}
	
	hivepress()->template->fetch_block($blocks, 'vendor_image');
	
	return $blocks;
}
1 Like

it worked perfectly! thank you very much

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.