Skip to content

Instantly share code, notes, and snippets.

@hivepress
Created July 23, 2022 23:36
Show Gist options
  • Select an option

  • Save hivepress/f86aaa3e40c939c6851ea2652a02fb8c to your computer and use it in GitHub Desktop.

Select an option

Save hivepress/f86aaa3e40c939c6851ea2652a02fb8c to your computer and use it in GitHub Desktop.
Add vendor email link to the listing page #hivepress #listings
<?php
add_filter(
'hivepress/v1/templates/listing_view_page/blocks',
function( $blocks, $template ) {
$listing = $template->get_context( 'listing' );
if ( $listing ) {
$blocks = hivepress()->helper->merge_trees(
[ 'blocks' => $blocks ],
[
'blocks' => [
'listing_actions_primary' => [
'blocks' => [
'vendor_email_link' => [
'type' => 'content',
'content' => '<a href="mailto:' . esc_attr( $listing->get_user__email() ) . '">Contact Vendor</a>',
'_order' => 5,
],
],
],
],
]
)['blocks'];
}
return $blocks;
},
1000,
2
);
@hivepress
Copy link
Author

Sorry, there's no simple code snippet for this, but if you created a Phone attribute for vendors this may be possible with customizations. Please try using our community forum, there's a category for dev-related questions https://community.hivepress.io/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment