# Booking button for featured listings only

**URL:** <https://community.hivepress.io/t/booking-button-for-featured-listings-only/2553>\
**Category:** Bookings\
**Tags:** bookings\
**Created:** [October 27, 2022, 7:54am UTC](https://community.hivepress.io/t/booking-button-for-featured-listings-only/2553 "2022-10-27T07:54:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nan91](https://community.hivepress.io/letter_avatar_proxy/v4/letter/n/f0a364/32.png) [@nan91](https://community.hivepress.io/u/nan91)\
**Post date:** [October 27, 2022, 7:54am UTC](https://community.hivepress.io/t/booking-button-for-featured-listings-only/2553/1 "2022-10-27T07:54:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Vasiliy](https://community.hivepress.io/user_avatar/community.hivepress.io/vasiliy/32/2333_2.png) [@Vasiliy](https://community.hivepress.io/u/Vasiliy)\
**Post date:** [October 27, 2022, 10:59am UTC](https://community.hivepress.io/t/booking-button-for-featured-listings-only/2553/4 "2022-10-27T10:59:58Z")

</div>

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

```auto
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);

```

---

<div class="post-metadata">

**Author:** ![nan91](https://community.hivepress.io/letter_avatar_proxy/v4/letter/n/f0a364/32.png) [@nan91](https://community.hivepress.io/u/nan91)\
**Post date:** [October 27, 2022, 12:56pm UTC](https://community.hivepress.io/t/booking-button-for-featured-listings-only/2553/5 "2022-10-27T12:56:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ihor](https://community.hivepress.io/user_avatar/community.hivepress.io/ihor/32/5_2.png) [@ihor](https://community.hivepress.io/u/ihor)\
**Post date:** [October 27, 2022, 5:16pm UTC](https://community.hivepress.io/t/booking-button-for-featured-listings-only/2553/7 "2022-10-27T17:16:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://community.hivepress.io/user_avatar/community.hivepress.io/system/32/13990_2.png) [@system](https://community.hivepress.io/u/system)\
**Post date:** [November 26, 2022, 5:17pm UTC](https://community.hivepress.io/t/booking-button-for-featured-listings-only/2553/8 "2022-11-26T17:17:19Z")

</div>

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