I want to change the icon and text for the favorite toggle.
- Change the icon to a custom SVG one - not using the HivePress icons
- Change “Add to Favorites” to “Save Listing”
Here’s the code:
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' => [
'listing_favorite_toggle' => [
'type' => 'favorite_toggle',
'_order' => 20,
'attributes' => [
'class' => [ 'hp-listing__action', 'hp-listing__action--favorite', 'test'],
],
'captions' => [
'Save Listing',
'Remove Listing'
],
'icon' => 'map-marker'
],
],
],
],
]
)['blocks'];
}
return $blocks;
},
1000,
2
);
I can’t find what keys I need to use, or could I change the whole block? i.e.
'content' => '<a>Save Search</a>'
Can someone help me out?