Social Links inside of Listing View Block?

I know I can insert different attributes into a Listing VIew beyond the standard Title, Address, Cagteory and Created Date? But what about Social Links? I have the additional plugin and I have the links on my main listing page, but I’d like them to appear on the listing results pages as well at the buttom of each listing. Is there a way to incorporate that?

I tried this approach in functions.php but to no avail:

add_filter(
	'hivepress/v1/templates/listing_view_block',
	function( $template ) {
		return hivepress()->helper->merge_trees(
			$template,
			[
				'blocks' => [
					'listing_social_links' => [
						'type'   => 'social_links',
						'content' => 'Social Links',
						'_order' => 150,
					],
				],
			]
		);
	},
	1000
);

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

add_filter(
	'hivepress/v1/templates/listing_view_block',
	function( $template ) {
		return hivepress()->helper->merge_trees(
			$template,
			[
				'blocks' => [
					'listing_footer' => [
						'blocks' => [
							'listing_social_links' => [
								'type'   => 'social_links',
								'model'  => 'listing',
								'_order' => 30,
							],
						],
					],
				],
			]
		);
	},
	1000
);
1 Like

That worked great but you’re right about the further customization. I see now the icons are all in a right column of what seems to be a three column footer. How can I drop that div down to its own row because clear:both; doesn’t seem to work.

Also, is there a way to add a heading on top of the Social Links? I tried adding

‘content’ => ‘Social Links’,

to the overall array, but no luck.

1 Like
  1. As a possible solution please try this CSS snippet but please note that it can require further customization
.hp-listing--view-block .hp-listing__footer{
	flex-direction: column;
}
  1. Please try this PHP snippet to add a title to social links but please note that it can require further customization
add_filter(
	'hivepress/v1/templates/listing_view_block',
	function( $template ) {
		return hivepress()->helper->merge_trees(
			$template,
			[
				'blocks' => [
					'listing_footer' => [
						'blocks' => [
							'listing_social_links_wrapper' => [
								'type'       => 'container',
								'_order'     => 20,
								'blocks' => [
									'listing_social_links_title' => [
										'type' => 'content',
										'content' => 'Your title here',
										'_order' => 10,
									],
									
									'listing_social_links' => [
										'type'   => 'social_links',
										'model'  => 'listing',
										'_order' => 30,
									],
								],
							],
						],
					],
				],
			]
		);
	},
	1000
);
3 Likes

That worked great! Thank you!

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