How can I change the location of the block?

Good afternoon, dear developers, how can I change the location of the block?
I want to place a block with a price in the 3rd place after the title on the advertisement page
I used this code but it was incorrect

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

mobile

Hi,

If you mean order price on the listing block on the home page, then please check this topic: Change price position - #5 by nikesh.p251087

​I hope this is helpful to you.

Sorry Andrey, but no matter what value I set to this code, it does not move over the description and title.
I want to move this block on top of the description and title

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

@andrii if the plugin does not provide filters or hooks for this, please write the path to the file, I will edit the file itself (Yes, I know that after the update the changes will be deleted)
Thanks

Hi,

Yes, this is a valid hook, so everything should work correctly. We recommend using our template functions: hivepress()->template->fetch_block and hivepress()->template->merge_blocks to move the block. But please note that the block will move on the desktop as well; if you need it only on mobile, you can do it only with JavaScript.

1 Like

I agree with you, the code works, but the block with the price (listing_attributes_primary) cannot move on top of the title and description, the block only moves to the bottom of the page.
Could you please share the JS code as any specialist will not know your code at your professional level.

If there is no JS code, could you please share the solution, we will be very happy to hear from you!
We want to move this block on top of the ad header

2 Likes

Hi,

Unfortunately, we cannot provide a snippet, as it is not within our scope of support. Also, it requires a detailed review and testing. I recommend considering hiring experts: Customization | HivePress

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