Display vendor email

Hello, how can I display the email of the author on the listing page? Just under the name, you can see what i mean with the picture.

Please try this PHP snippet but please note that it can require further customization

add_filter(
	'hivepress/v1/templates/vendor_view_block/blocks',
	function($blocks, $template){
		$vendor = $template->get_context('vendor');
		
		if(!$vendor){
			return $blocks;
		}
		
		$user = $vendor->get_user();
		
		if(!$user){
			return $blocks;
		}
		
		$email = $user->get_email();
		
		return hivepress()->helper->merge_trees(
					[ 'blocks' => $blocks ],
					[
						'blocks' => [
							'vendor_content' => [
								'blocks' => [
									'custom_vendor_email' => [
										'type' => 'content',
										'content' => '<p>'.$email.'</p>',
										'_order'=> 11,
									],
								],
							],
						],
				]
				)['blocks'];
	},
	1000,
	2
);

thank you it works!

1 Like

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