Add a custom button to a user block

Hi everyone.
I use plugin Snippets Code as suggested.
I’m trying to add a custom button into a user block.
Please help to find a mistake. Thank you!!!
Here’s what i have:

add_filter(
	'hivepress/v1/templates/user_view_block', 
	function( $template ) {
	return hivepress()->helper->merge_trees(
		$template, 
		[
				'blocks' => [
					'user_container' => [
							'blocks'     => [
								'user_content' => [
									'blocks'     => [
										'contact_button_custom' => [
												'type'    => 'content',
												'content' => '<a href="/booking-form" class="button">Contact</a>',
												'_order'  => 123,
											]
									]
								]
								
						]
					]
				]
	
		]
	);
}
);

Solved. I should’ve changed user to vendor.

add_filter(
	'hivepress/v1/templates/vendor_view_block', 
	function( $template ) {
	return hivepress()->helper->merge_trees(
		$template, 
		[
				'blocks' => [
					'vendor_container' => [
							'blocks'     => [
								'vendor_content' => [
									'blocks'     => [
										'contact_button_custom' => [
												'type'    => 'content',
												'content' => '<a href="/booking-form" class="button">Contact</a>',
												'_order'  => 123,
											]
									]
								]
								
							]
					]
				]
	
		]
	);
}
);
1 Like

Thanks for sharing the solution!

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