I am trying to add a button to the listing category view block that makes it more clear where customers should click to view the listings.
Here is the code I am trying to use but it returns an error and breaks the site. How should I edit this?
add_filter(
'hivepress/v1/templates/listing_category_view_block/blocks',
function ($blocks, $template){
$listing_category = $template->get_context('listing_category');
if(!$listing_category){
return $blocks;
}
$listing_category_id = $listing_category->get_id();
if(!$listing_category_id){
return $blocks;
}
return hivepress()->helper->merge_trees(
[ 'blocks' => $blocks ],
[
'blocks' => [
'listing_category_details_primary' => [
'blocks' => [
'listing_category_page_link' => [
'type' => 'content',
'content' => '<a class="button button--large button--primary hp-button--wide" href="'.esc_url( hivepress()->router->get_url( 'listing_category_view_page', [ 'listing_category_id' => $lising_category->get_id() ] ) ).'"><b>View Yachts</b></a>',
'_order' => 30,
],
],
],
],
]
)['blocks'];
},
1000,
2
);