Summary:
In the vendor card (e.g. hp-vendor__attribute--listing-count
), the listing count label always shows “listings”, even when the count is 1. This results in incorrect grammar like “1 listings”.
Expected behavior:
It should display “1 Listing” when the count is exactly 1, and “X Listings” otherwise.
Current behavior:
The label always says “listings”, regardless of whether there’s 1 or more listings.
Where it appears:
- Vendor summary card (
hp-vendor__summary
) - Vendor profile section on listing pages
Suggested fix:
Use WordPress’s _n()
function to handle singular/plural properly:
php
echo sprintf(
_n('%s Listing', '%s Listings', $listing_count, 'hivepress'),
number_format_i18n($listing_count)
);
Temporary fix (PHP Snippet):
(only changes the rendered HTML)
add_action('template_redirect', function () {
ob_start(function ($content) {
return preg_replace_callback(
'/>(\d+)\slistings</i',
function ($matches) {
$count = (int) $matches[1];
$label = $count === 1 ? 'Listing' : 'Listings';
return ">{$count} {$label}<";
},
$content
);
});
});