The page title template is not displayed

Hey, I found your articles explaining how to edit the pages/templates added by HivePress. I managed to successfully create a new template and add a section that I wanted to. However, to make the ‘Listings’ page match the rest of my site, I wanted the page to display the default page title. I’ve tried using the ‘Page Title’ block but it doesn’t seem to be doing anything when I check the front-end.

Here’s how it looks on the backend:

But, when I look on the front the ‘Page Title’ block is completely missing.

Hi,

Please note that there is an exception for the default title of this page, because the theme hides the default title and adds category header instead, so it would require a custom implementation to change the layout.

Thanks for the reply, Andrii.

I’ve noticed this page, in particular, seems to get mentioned a lot when users are trying to customise HivePress.

I have watched the template customisation videos and followed along step-by-step. However, the page shown after you make a search (Listings? / Listings View Page?) was proving difficult to override and actually display what I wanted through using using HivePress > Templates.

So, I ended up using snippets instead, and I’ve finally managed to achieve what I wanted by using this:

add_filter(
	'hivepress/v1/templates/listings_view_page',
	function( $template ) {
		return hivepress()->helper->merge_trees(
			$template,
			[
				'blocks' => [
					'page_header' => [
						'blocks' => [
							'custom-block-name' => [
								'type'    => 'content',
								'content' => 'custom code here',
								'_order'  => 0,
							],
						],
					],
				],
			]
		);
	}
);

I could have added more customisation that I attempted, but to be on the safer side; I got things to show using the method above, then just made them look nice using CSS.

I’m sure others will find this useful, so feel free to rename the topic.

I find the terminology used in HivePress quite confusing at times, so I expect others will as well. In case other people are searching for ways to do this, hopefully, Google picks up on some of these keywords: “search page results”, “results page”, “search results page”, “search page”, “after searching”, “after making a search”, “after you search”, “when you search”.

1 Like

Thanks for sharing the solution, we’ll try to improve the docs and add more tutorials for developers.

If you also want to restrict the added title to the Listings page only, please try this code snippet Add Title and description to the default Listings page - #4 by ihor

Hope this helps

Hey @ihor,

Thanks for replying!

I tried using the snippet you linked to above. However, I found my custom additions are added below the search bar, and changing the order didn’t seem to help. The version I quoted before was allowing me to add my custom additions above the search bar, but, after some more testing I found it ‘bled through’ onto the pages that show once you click a category and the category header is the top of the page.

So, unfortunately, neither of the snippets are working exactly as I’d hoped, so I’ve removed them for now. Is it possible to either use my snippet and ‘stop the bleeding’, so it doesn’t also show on the category pages? …Or, use your snippet, but allow for additions above the search bar?

I hope that makes sense! :slight_smile:

Cheers,
Chris

Sure, if you want it to appear above or under the search bar, please try changing “page_content” to “page_header” in the linked code snippet, along with changing the “_order” parameter if needed.

1 Like

Many thanks @ihor, this seems to be working as intended now! :folded_hands: