Filter the description meta tag.
Parameters
$value
$params
(array) associative array with contextual data
You need to have a working knowledge of Hooks before you get started.
Boilerplate Code
Use the boilerplate code to start using the filter, and add your own logic to modify the first argument and return it.
Clickfwd\Hook\Filter::add('page_description_metatag', function($value, $params)
{
// Uncomment line below to view available data passed into hook
// For JReviews 3.x and earlier use dd instead of fwd_dd
// fwd_dd($value, $params);
return $value;
});
Development & Support
Customizations are not included with support. We provide this information to make it easier for developers to extend the functionality. From time to time we may have some availability for custom work. Get in touch to see if there's an opportunity to work together.
Examples
If you sell paid listings, you could include as part your paid plans having a customized meta description tag to make the listings more discoverable for SEO. This simple example shows how to approach this.
Clickfwd\Hook\Filter::add('page_description_metatag', function($value, $params)
{
$listing = $params['listing'] ?? null;
// Only continue if it's a listing detail page
if (! $listing) {
return $value;
}
// Only continue if listing is in a paid category
if (empty($listing['Paid'])) {
return $value;
}
// Only continue if it's a featured listing
if (! $listing['Listing']['featured']) {
return "Generic meta description for listing {$listing['Listing']['title']}";
}
// Featured listings show the custom meta description or if empty the listing summary
return $listing['Listing']['metadesc'] ?: substr($listing['Listing']['summary'], 0, 150).'...';
}
Source
-
/services/metatags/metatags.php
-
/cms_compat/wordpress/plugins/yoast_compat_lists.php
-
/cms_compat/wordpress/includes/plugins/jreviews.php
-
/cms_compat/joomla/includes/plugins/jreviews.php
-
/cms_compat/joomla/includes/plugins/jreviews-joomla4.php