Would like "Book Now" widget to be above Primary Block on Listings Page (RentalHive)

Is there any way to change the order of Blocks/ widgets on the listing page? I would like to have the “Book Now” widget be above the Primary Block on the listing page. Is that possible? Thanks.

Excuse me, I would like the “Book Now” widget above the primary area on the listing page. Thanks.

Hi yes you can do it with a code snippet. Copy and add this code snippet. You can change the order number 123 in the bottom and it will change the order of the primary area. The higher the number it goes lower on the sidebar widget area.

add_filter(
	'hivepress/v1/templates/listing_view_page',
	function( $template ) {
		return hivepress()->helper->merge_trees(
			$template,
			[
				'blocks' => [
					'listing_attributes_primary' => [
						'_order' => 123,
					],
				],
			]
		);
	},
	1000
);
1 Like

This only changed the order of the listing attributes in primary area. I tried changing the order, and the primary area attributes changed. I’m hoping that the “Book Now” Section is above the primary area on the listings page. Meaning that the “Book Now” area is closer to the top of the page. Thanks.

Which theme do you have? I have listinghive and the above code puts the book now on the top right with the primary page attributes on the bottom. If you put a high number like 1000, it will push it way down. However, I’m guessing your theme might be different.

I have another code snippet but it puts the primary attributes instead on the bottom of listing page description. Would that help?

I’m using RentalHive. There’s two separate areas, one with the primary attribute info, the other with a book now area. Changing the order only changes the attributes in the Primary area, and the book now area is still below the primary area. Having the primary attributes area at the bottom of the listing page should help. Thanks.

ok try this one (you can change the order number to adjust the location):

add_filter(
	'hivepress/v1/templates/listing_view_page',
	function( $template ) {
		return hivepress()->helper->merge_trees(
			$template,
			[
				'blocks' => [
					'page_sidebar' => [
						'blocks' => [
							'listing_attributes_primary' => [
								'type' => 'content',
							],
						],
					],
					
					'page_content' => [
						'blocks' => [
							'listing_attributes_primary' => [
								'type'      => 'attributes',
								'model'     => 'listing',
								'area'      => 'view_page_primary',
								'_label'    => hivepress()->translator->get_string( 'attributes' ) . ' (' . hivepress()->translator->get_string( 'primary_plural' ) . ')',
								'_settings' => [ 'columns' ],
								'_order'    => 61,
							],
						],
					],
				],
			]
		);
	},
	1000
);

Now there’s a somewhat blank box where the rating is located. Would there be any way to take the first two attributes in the listing to be shown in the box with the rating? Thanks.

*The first two primary attributes to be shown in the box where the rating is. Thanks.

Can you take a screenshot, shift+windows key+ s for snipping tool or use lightshot. Its hard to visualize what you need. That way the hivepress support can see if they can modify it or not with code snippet.

I want the first two attributes in blue ($50/ hr; 2 hour min.) to be in the same box as the rating area. Is that possible? Thanks

Never mind, I just moved the “Reference Tracks” to the secondary Page area, and disengaged the code snippet. That seemed to solve my problem. The problem was that I had too many attributes in the Primary area on the listing page. which was pushing the Book Now button further down the bottom of the page. Thanks.

Yes I was just looking at your site and was going to tell you. Nice site by the way! Looking nice! But yea if you wanted the booking above the price and rating, you can do that as well

1 Like

RentalHive has a bit different markup, this snippet should work for moving the box with the primary attributes and rating:

add_filter(
	'hivepress/v1/templates/listing_view_page',
	function( $template ) {
		return hivepress()->helper->merge_trees(
			$template,
			[
				'blocks' => [
					'listing_topbar' => [
						'_order' => 123,
					],
				],
			]
		);
	},
	1000
);

Thanks @aqmiami7

1 Like

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