Free Directory, Listing & Classifieds WordPress Plugin Support Themes ListingHive Hide ‘reply to listing’ function for certain listings Reply To: Hide ‘reply to listing’ function for certain listings

ihordeveloper

This one should do it, please replace “attributename” with the slug of the custom checkbox attribute you added (it should be lowercase and with underscores instead of spaces):

add_filter( 'hivepress/v1/templates/listing_view_block/blocks', 'add_custom_verified_badge', 10, 2 );
add_filter( 'hivepress/v1/templates/listing_view_page/blocks', 'add_custom_verified_badge', 10, 2 );

function add_custom_verified_badge( $blocks, $template ) {
	$listing = $template->get_context( 'listing' );

	if ( $listing && $listing->is_attributename() ) {
		$blocks = hivepress()->helper->merge_trees(
			[ 'blocks' => $blocks ],
			[
				'blocks' => [
					'listing_title' => [
						'blocks' => [
							'attributename' => [
								'type'    => 'content',
								'content' => '<i class="hp-listing__verified-badge hp-icon fas fa-check-circle" title="Custom title here"></i>',
								'_order'  => 100,
							],
						],
					],
				],
			]
		)['blocks'];
	}

	return $blocks;
}

You can also change the icon by replacing the “check-circle” with another icon name https://fontawesome.com/icons?d=gallery&m=free

Subscribe

Sign In

Don't have an account? Register

Forgot password?

Register

Already have an account? Sign In

Forgot password?

Reset Password

Please enter your username or email address, you will receive a link to create a new password via email.