Booking button for featured listings only

Hi!

I would like to ask whether is it possible to do that. So I want to allow only the featured listings to have a booking/reservation button but. Are there any methods/snippet to prevent booking or hide the button from the “normal listings”. Or any ways how to do that?

Thank you for the reply.

Good day!
Here is a code snippet to show the booking block in features listing pages.

add_filter('hivepress/v1/templates/listing_view_page/blocks', function ($blocks, $template) {
	$listing = $template->get_context('listing');

	if (!$listing || $listing->get_featured()) {
		return $blocks;
	}

	hivepress()->template->fetch_blocks($blocks, ['booking_make_form']);

	return $blocks;
}, 1000, 2);
1 Like

Thank you for the reply!

Sorry but I cannot try at this moment because I don’t have bookings plugin yet. If it works 100% I will buy the addon.

1 Like

Yes, the code snippet above removes the booking form if the listing is not featured.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.