Duplication of information from the sitebar before the description of the listing in the mobile version of the site

Hi.

In the mobile version of the site, the information in the sitebar is displayed at the end of the listing.
How to duplicate information from the sitebar before the listing description?

Thanks.

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

@media screen and (max-width: 47.99em){
	.hp-template--listing-view-page .hp-page__sidebar{
		order: 0;
	}
	
	.hp-template--listing-view-page .hp-page__content{
		order: 1
	}
}

You suggest moving the sitebar to the top of the listing. It is not necessary.
I need to duplicate the information from the sitebar after the listing photo.

I opened plugin files → includes → templates → class-listing-view-page.php.
Copied part of the code from ‘page_sidebar’ => […
Paste between
‘listing_attributes_secondary’ => […
and
‘listing_description’ => […
It works, but is it possible to do this?

Please don’t edit these files directly, it’s possible to override the template blocks via the hivepress/v1/templates/listing_view_page filter.

You can start with this snippet to fully duplicate the sidebar, but it’ll probably require further customizations:

add_filter(
	'hivepress/v1/templates/listing_view_page',
	function( $template ) {
		return hivepress()->template->merge_blocks(
			$template,
			[
				'page_columns' => [
					'blocks' => [
						'my_block_name' => hivepress()->template->fetch_block( $template, 'page_sidebar', false ),
					],
				],
			]
		);
	}
);

Can you write an example to show the result?
I don’t understand how to implement.
Thanks.

The suggested code snippet should actually duplicated the sidebar, but it may require extra CSS customizations for layout. Please try adding the above snippets via the Code Snippets plugin.

Sorry to distract you again.

You suggest copying the entire sitebar to the end of the listing.

But I need to transfer some information from the sitebar to a place between

listing_attributes_secondary
and
‘listing_description’ .

Tell me, please, how to do it?

You can try the same snippet but with other block names and containers where they should be moved, for example:

add_filter(
	'hivepress/v1/templates/listing_view_page',
	function( $template ) {
		return hivepress()->template->merge_blocks(
			$template,
			[
				'page_content' => [
					'blocks' => [
						'my_block_name' => hivepress()->template->fetch_block( $template, 'listing_attributes_primary' ),
					],
				],
			]
		);
	}
);

This should move the primary attributes to the left column.

1 Like

Thanks, Ihor.

If I copy your code, then the information of one block from the sitebar is transferred, but it is not duplicated.

If I add FALSE

‘my_block_name’ => hivepress()->template->fetch_block( $template, ‘listing_attributes_primary’, false),

Then the block from the sitebar is duplicated.

But I need to duplicate the blocks before the listing description.

Does anyone know how to do this?

Thanks.

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

add_filter(
	'hivepress/v1/templates/listing_view_page',
	function( $template ) {
		return hivepress()->template->merge_blocks(
			$template,
			[
				'page_content' => [
					'blocks' => [
						'custom_sidebar_copy_wrapper' => [
							'type'       => 'container',
							'_order'     => 50,
							
							'blocks' => [
								'custom_sidebar_copy_attribute' => hivepress()->template->fetch_block( $template, 'listing_attributes_primary', false ),
								'custom_sidebar_copy_actions' => hivepress()->template->fetch_block( $template, 'listing_actions_primary', false ),
							],
						],
					],
				],
			]
		);
	},
	1000
);
1 Like

Thanks.
That’s what I need.
You are the best tech support! @ihor

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