How to add description/text to listing category page footer

Hi,

I need to add description on the bottom of the listing category page - basically, the listings view page. Currently, any descrpiption added only shows in the header part - I need to move it down below the listings.

This similar question was answered here Adding description in listing category page but the code didn’t work.
Looks like it addresses the listing_view_page (individual listing) but we need to add text to the listing category page. Please advise.

Thank you

Hi,

Yes, it is possible, but it will require a custom implementation. If you are familiar with coding or have a developer, please check these samples: Search · user:hivepress template · GitHub

​I hope this is helpful to you.

Hi Andrii,

None of us were able to get it working, unfortunately.

add_filter(
	'hivepress/v1/templates/listings_view_page',
	function( $template ) {
		return hivepress()->helper->merge_trees(
			$template,
			[
				'blocks' => [
					'page_content' => [
						'blocks' => [
							'listing_category_description' => [
                                    'type' => 'part',
                                    'path' => 'listing-category/view/listing-category-description',
                                        '_order' => 10,
                                    ],
						],
					],
				],
			]
		);
	},
	10
);

The text doesn’t populate on the ‘listings_view_page’ no matter which way we tried. It only shows in the header and not in the actual page content.

This is crucial for SEO purposes. Would really appreciate your help.

Thank you

Hi,

Can you please help with this?
3 different developers weren’t able to get it working. Is it something very basic we’re missing?

Thank you

Hi,

Please make sure that such a template part exists. Also, please check if the snippet itself works correctly and embeds the block using the example of this snippet: Add custom content to the listing search page sidebar #hivepress #templates · GitHub

Hi Andrii,

I want to add it to the actual page content and not the sidebar. And it’s not fixed, pre-set content - it’s the listing category description that is unique to each page.

I tried the above by changing ‘page_sidebar’ to ‘page_content’ and it doesn’t work.

This template exists:

'listing_category_description'     => [
										'type'   => 'part',
										'path'   => 'listing-category/view/listing-category-description',
										'_order' => 30,
									],

But no code snippet is adding a simple content block to the listings page.

Basically the main content section of this page: Real Estate – ListingHive.
The only option is listing category description but it shows on top in the header, where you have to keep it very short so you can’t really add any valuable content.

Seems like a simple thing but nothing is working.

Please try this code snippet:

add_filter(
	'hivepress/v1/templates/listings_view_page',
	function( $template ) {
		if ( hivepress()->request->get_context( 'listing_category' ) ) {
			$template = hivepress()->template->merge_blocks(
				$template,
				array(
					'page_footer' => array(
						'blocks' => array(
							'listing_category_description' => array(
								'type'   => 'part',
								'path'   => 'listing-category/view/listing-category-description',
								'_order' => 1000,
							),
						),
					),
				)
			);
		}

		return $template;
	},
	1000
);
1 Like

Thanks Ihor. Just tried. Doesn’t work. :slightly_frowning_face:

Hi,

Please make sure you add this PHP snippet using this doc: How to add custom code snippets - HivePress Help Center. If you don’t see the changes, please provide more details about which theme you are using and we will try to help.

Hi Andrii,

Yes, using a child theme for ListingHive and added the code to the functions file.
Would you like me to privately share the exact page and the login info?

Unfortunately we can’t debug custom code directly on your site, this is beyond the support scope, but we tested it locally twice (with ListingHive theme) and it should be ok. I recommend trying another way to add this code snippet, e.g. Code Snippets – WordPress plugin | WordPress.org

It worked?
For us, it stays in the header, no matter how we try. Also tried the snippets plugin just to be sure but no change. Everything else in the functions file is populating well but there’s no moving the category description text from the header.

Sorry for the confusion, this snippet duplicates description in the page footer but doesn’t remove it from the header, it should be removed either via CSS or via the child theme (by editing the category header template part).

Hi Ihor,

No, that’s fine. Removing it is not a problem. The only issue is, the content doesn’t show anywhere else on the page - in the main body.

Hi,

This snippet duplicates the description on the /listing-category/real-estate page, as you can see in the screenshot: Awesome Screenshot

Hi Andrii, Ihor,

Thank you for your help. I know what’s happening. We created a custom template for the listing category page without the sidebar and this change doesn’t work there. I’ll try to edit the original template to our needs and see at what point the description vanishes.

Update:
Ok, we need to have the ‘Term description’ block for this to work.
I was using the ‘Hive press page description’ earlier.

Thank you so much!! :pray:

2 Likes

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