Jump to content
JoshLewis

Strip out shortcodes in listing list view

Recommended Posts

JoshLewis

Recently wanted to have shortcodes stripped from listing list view. Based on the docs I modified it to:

/* Strip out listing list views summary shortcodes */

function list_page_replace_summary($listings, $params)
{
	foreach ($listings as & $listing)
	{
		if ( $listing['Listing']['description'] )
		{
			// Uncomment line below to show truncated description instead of summary in listing list view
			// $listing['Listing']['summary'] = $listing['Listing']['description'];
			$listing['Listing']['summary'] = strip_shortcodes($listing['Listing']['summary']);
		}
	}
 
	return $listings;
}
 
Clickfwd\Hook\Filter::add('post_get_listings_listpage_query', 'list_page_replace_summary', 10);

This allows other neat variations such as conversions and alternative data display.

Share this post


Link to post

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Please refer to our Privacy Policy.