How to set dynamic title for related listing block

Listing title is ’ ABC homes’. How can I set the related listings title to Listing similar to ABC homes?

It’s possible but this would require a custom code snippet, if you’re familiar with customization basics please try customizing the listing page template via the hivepress/v1/templates/listing_view_page filter Customizing Templates I HivePress Developer Docs - YouTube

Thanks brother. But I’m not able to find a directory named V1 inside Hivepress.
This is my directory structure: opt/bitnami/wordpress/wp-content/plugins/Hivepress/templates/…

I have tried overriding few other templates by copying Hivepress and it’s subdirectory structure to child theme folder. But none of them is working.

It’s not a file path but a WordPress filter hook, please check the code examples for the single listing page here Search · user:hivepress listing_view_page · GitHub It’s possible to set a dynamic title, but this requires a custom function for the hivepress/v1/templates/listing_view_page filter.

Hope this helps.

@ihor, I have tried using the below code but it is not working. Here I have tried to rename the ‘Related listing’ to ‘Auto parts’. I know how to make it dynamic name. But this code itself is not working. could you please help me to correct this code.


add_filter(
	'hivepress/v1/templates/listing_view_page',
	function( $title ) {
		$title['related_listings_container']['rewrite'] = 'auto-parts';

		return $title;
	},
        10
);

Please try this PHP snippet

add_filter(
	'hivepress/v1/templates/listing_view_page',
	function( $template ) {
		return hivepress()->helper->merge_trees(
			$template,
			[
				'blocks' => [
					'related_listings_container' => [
						'title' => 'Your content here',
					],
				],
			]
		);
	},
	1000
);

Thanks a lot @yevhen it is working perfectly

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