Please try this PHP snippet. Please save this part ?listing_id='.$listing->get_id()
in url as it contains listing ID which you can use by your requirements
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' => [
'custom_icon_print' => [
'type' => 'content',
'content' => '<button type="button" class="button button--primary hp-button--wide" data-component="link" data-url="your_url_here?listing_id='.$listing->get_id().'">Custom text here</button>',
'_order' => 1000,
]
]
],
]
]
)['blocks'];
}
return $blocks;
},
1000,
2
);