# Enable/show each listing description on a /listings/ page

**URL:** <https://community.hivepress.io/t/enable-show-each-listing-description-on-a-listings-page/17746>\
**Category:** ListingHive\
**Created:** [June 5, 2026, 3:12pm UTC](https://community.hivepress.io/t/enable-show-each-listing-description-on-a-listings-page/17746 "2026-06-05T15:12:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![obtrusive170](https://community.hivepress.io/letter_avatar_proxy/v4/letter/o/8dc957/32.png) [@obtrusive170](https://community.hivepress.io/u/obtrusive170)\
**Post date:** [June 5, 2026, 3:12pm UTC](https://community.hivepress.io/t/enable-show-each-listing-description-on-a-listings-page/17746/1 "2026-06-05T15:12:33Z")

</div>

This adds 100 characters long description from each listing into each listing box at /listings/  
Ensures that long text lines without spaces does not overflow the listing box.  
Feedback/improvement is welcome. This is done thanks to [HivePress AI Assistant](https://www.chatbase.co/PdfFucPZ0vUmh3dfM-oe1/help) (it took around 10 attempts and it have been unable to deliver CSS into the PHP snippet itself), but anyway it works:

PHP snippet (for example plugin Code snippets):

```auto
// This script needs also CSS which is defined at /wp-admin/customize.php , Additional CSS.
add_filter(
	'hivepress/v1/templates/listing_view_block/blocks',
	function( $blocks, $template ) {
		$listing = $template->get_context('listing');
		
		if ( $listing && $listing->get_description() ) {
			$description = $listing->get_description();
			
			// Truncate to 100 characters
			if ( strlen( $description ) > 100 ) {
				$description = substr( $description, 0, 100 ) . '...';
			}
			
			$blocks = hivepress()->helper->merge_trees(
				['blocks' => $blocks],
				[
					'blocks' => [
						'listing_content' => [
							'blocks' => [
								'custom_listing_description' => [
									'type' => 'content',
									'content' => '<p class="hp-listing__description-preview">' . esc_html( $description ) . '</p>',
									'_order' => 999,
								],
							],
						],
					],
				]
			)['blocks'];
		}
		
		return $blocks;
	},
	1000,
	2
);

```

CSS code for that:

```auto
/* A CSS for a PHP snippet which adds a listing description to a /listings/ page. This CSS moves description to bottom and fix overflow: */
.hp-listing__content > p {
    order: 999;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    max-width: 100%;
    padding: 0 15px;
    margin: 10px 0 0 0 !important;
}

.hp-listing__content {
    display: flex;
    flex-direction: column;
}

.hp-listing__categories {
    order: 1;
}

.hp-listing__title {
    order: 2;
}

.hp-listing__details {
    order: 3;
}

```

---

<div class="post-metadata">

**Author:** ![ChrisB](https://community.hivepress.io/user_avatar/community.hivepress.io/chrisb/32/14185_2.png) [@ChrisB](https://community.hivepress.io/u/ChrisB)\
**Post date:** [June 5, 2026, 4:57pm UTC](https://community.hivepress.io/t/enable-show-each-listing-description-on-a-listings-page/17746/2 "2026-06-05T16:57:56Z")

</div>

Hi @obtrusive170,

Thanks for sharing this with the community! 🙏

I believe someone else also shared their approach here:

- [Add Category and Desc. Preview to Listing Cards](https://community.hivepress.io/t/add-category-and-desc-preview-to-listing-cards/5347)

Cheers,  
Chris ✌

---

<div class="post-metadata">

**Author:** ![kseniia](https://community.hivepress.io/user_avatar/community.hivepress.io/kseniia/32/13513_2.png) [@kseniia](https://community.hivepress.io/u/kseniia)\
**Post date:** [June 9, 2026, 9:02am UTC](https://community.hivepress.io/t/enable-show-each-listing-description-on-a-listings-page/17746/3 "2026-06-09T09:02:49Z")

</div>

Hi,

Thanks for the solution!

It can be really helpful for other users.

---

<div class="post-metadata">

**Author:** ![system](https://community.hivepress.io/user_avatar/community.hivepress.io/system/32/13990_2.png) [@system](https://community.hivepress.io/u/system)\
**Post date:** [July 9, 2026, 9:03am UTC](https://community.hivepress.io/t/enable-show-each-listing-description-on-a-listings-page/17746/4 "2026-07-09T09:03:33Z")

</div>

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