Add description to listings block

Hi there!

I would like to display the description of a listing not only on the page of the listing itself, but on the listings block where all the listings are displayed.

I attached a screenshot. I want to display the description somewhere below listing image. Below the Location section would be great.

Is there a code to do just that?

Thank You

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

add_filter(
	'hivepress/v1/templates/listing_view_block/blocks',
	function( $blocks, $template ) {
		$listing = $template->get_context('listing');
		
		if($listing && $listing->get_description()){
			$blocks = hivepress()->helper->merge_trees(
					[ 'blocks' => $blocks ],
					[
						'blocks' => [
							'listing_details_primary' => [
								'blocks' => [
									'custom_listing_block_description' => [
										'type'    => 'content',
										'content' => '<p>'.esc_html($listing->get_description()).'</p>',
										'_order'  => 6,
									],
								],
							],
						],
				]
				)['blocks'];
		}
		
		return $blocks;
	},
	1000,
	2
);

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