Booking duration

Hello team, I need to put somewhere in the advert where the user can see it, the duration of the advert that the seller has previously filled in. Example:

  • minimum duration of days = 5
  • maximum duration of days = 7
    must appear somewhere:
    “reserar” 2 days duration.

thanks

Please try this PHP snippet but please note that it can require further customization

add_filter(
	'hivepress/v1/templates/listing_view_page/blocks',
	function( $blocks, $template ) {
		$listing = $template->get_context('listing');
		
		if(!$listing || !hivepress()->get_version('bookings') || hivepress()->booking->is_time_enabled($listing)){
			return $blocks;
		}
		
		$booking_min = intval($listing->get_booking_min_length());
		$booking_max = intval($listing->get_booking_max_length());
		
		if(!$booking_min || !$booking_max || $booking_min > $booking_max){
			return $blocks;
		}
		
		return hivepress()->helper->merge_trees(
					[ 'blocks' => $blocks ],
					[
						'blocks' => [
							'page_sidebar' => [
								'blocks' => [
									'custom_booking_time' => [
										'type'   => 'content',
										'content'  => '<p>Booking duration: '.($booking_max - $booking_min).'</p>',
										'_order' => 11,
									],
								],
							],
						],
				]
				)['blocks'];
	},
	1000,
	2
);

Thanks yevhen, that’s great. It’s just what I need.
But I would like to put it as it appears in the picture I passed.
Would that be possible?
Thank you very much again.
IT’S GREAT

Sorry for the inconvenience, but customization is beyond our support scope - it includes fixing bugs and guidance about the available features.

If customizations are required for your site, please try customizing it using the collection of code snippets Search · user:hivepress · GitHub and other developer resources, or consider hiring someone for custom work https://fwd.cx/hLhc73mQCD9R

I understand.

Is there a way to put an attribute in the display window of an ad under the description field?

In listinghive the free theme if you can but I would need to put it in experthive.

Please send more details about this issue, do you mean adding the same image banner under the description for all listings? The listing page layouts are similar in both themes, you can try using the available widget areas in Appearance/Widgets section (there are sidebar and footer areas).

I add a new attribute in the menu listing hive.
In listing hive you can specify in which zone it can be seen. In HIVE PRESS I would like to be able to see them in the window that appears in the attached photo. below or above ad details.

If it is a custom attribute then please try to set Page (secondary) as the Area option in the attribute. Then it will be shown above listing description on the single listing page

Thanks yevhen, that’s how I’ve done it. But is there any way I can make the attributes appear on one line each? doing a line break in each attribute?
Attached photo for reference.


Gracias yevhen, así lo he hecho. Pero hay alguna manera que pueda hacer para que los atributos aparezcan en una linea cada uno? haciendo un salto de linea en cada atributo?
adjunto foto de referencia.

You can try this CSS snippet:

.hp-listing--view-page .hp-listing__attributes--secondary {flex-direction: column!important}

Please consider hiring someone via Fiverr if customizations beyond the available options are required. We also plan to add more attribute options, e.g. the ability to create custom areas.

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