Remove link to from listing title and insert Learn More button to Listing View Block

This is kind of two fold. I want to do something where we remove the link in the listing’s name / title in the Listing View Block and instead have a Learn More button at the end of the block instead with that same link I want removed on top. Is there a function(s) that can do just that?

UPDATE: I figured out the code to add the Learn More link in the Listing View Block. So I just need to know how to remove the same link from the title on top of each block. Here’s the code I created to get the Learn More to work:

/**
 * Add Learn More Link to Listing View Block
 */
add_filter(
	'hivepress/v1/templates/listing_view_block/blocks',
	function ($blocks, $template){
		$listing = $template->get_context('listing');
		
		if(!$listing){
			return $blocks;
		}
		
		$listing_id = $listing->get_id();
		
		if(!$listing_id){
			return $blocks;
		}
		
		return hivepress()->helper->merge_trees(
					[ 'blocks' => $blocks ],
					[
						'blocks' => [
							'listing_actions_primary' => [
								'blocks' => [
									'listing_page_link' => [
										'type'   => 'content',
										'content'  => '<a class="btn-more" href="'.esc_url( hivepress()->router->get_url( 'listing_view_page', [ 'listing_id' => $listing->get_id() ] ) ).'">Learn More</a>',
										'_order' => 30,
									],
								],
							],
						],
				]
				)['blocks'];
	},
	1000,
	2
);

Please try to override the /listing/view/block/listing-title.php template part via a child theme. Please check this tutorial how to make changes in templates Customizing Templates I HivePress Developer Docs - YouTube

Ah, I forgot about moving templates to the child theme. That worked. Thanks.

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