Change text and custom icon Favorite button

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:

	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'

		return $blocks;

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?


We recommend changing the text through Loco Translate: How to change any static text - HivePress Help Center. As for the icon, it’s easier to do it with CSS: css - Is there a way to use SVG as content in a pseudo element ::before or ::after - Stack Overflow

No way to do this on the filter? Upon checking here,

Can see that it is being updated on the render, probably an issue here is the keys needed for this needs to be explicit.



Please note that the easiest way to change the text is to use Loco Translate. You can use CSS tweaks, but unfortunately, we can’t help with this as it is out of our support scope.