Switch Messaging to Mailto:

Our client would like to switch the messaging system to email links rather than using the messaging system. Is there a quick way to do this via the templates?

If we can alter the messaging links to:


That would be ideal.

Thanks for any help you can offer.

If only the email-based link is required then the Messages extension is not required at all, please try adding a custom Email attribute and set the <a href="mailto:%value%">Contact</a> display format for it. To avoid duplicating email addresses in the listing form, it may also be possible with a code snippet (based on the vendor email).

Any ideas where to start with the code snippet please? Just a point in the right direction would be advised and we can take it from there. :slight_smile:

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

	function( $blocks, $template ) {
		$listing = $template->get_context('listing');

		if($listing && $listing->get_vendor()->get_user__email()){
			$blocks = hivepress()->helper->merge_trees(
					[ 'blocks' => $blocks ],
					'blocks' => [
						'listing_actions_primary' => [
							'blocks' => [
								'listing_vendor_email_custom' => [
										'type'    => 'content',
										'content' => '<a href="mailto:'.esc_html($listing->get_vendor()->get_user__email()).'">Send email</a>',
										'_order'  => 1,
		return $blocks;

Thank you so much for that! :slight_smile:

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