{"id":2523,"date":"2026-10-20T08:34:13","date_gmt":"2026-10-20T07:34:13","guid":{"rendered":"https:\/\/wpgeodirectory.com\/documentation\/article\/badge-based-on-rating-or-review-count\/"},"modified":"2026-10-20T08:41:01","modified_gmt":"2026-10-20T07:41:01","slug":"badge-based-on-rating-or-review-count","status":"publish","type":"gd_place","link":"https:\/\/wpgeodirectory.com\/documentation\/article\/core-widgets\/badge-based-on-rating-or-review-count\/","title":{"rendered":"How to show a badge on listings based on rating or number of reviews"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Use the GD &gt; Dynamic Content block or <code>&#091;gd_dynamic_content&#093;<\/code> shortcode with the <code>rating_count<\/code> or <code>overall_rating<\/code> key. It prints your text only when the listing matches the condition you set. The GD &gt; Post Badge element cannot do this, because its field list only covers custom fields and a few post fields such as the post date, so ratings are not one of its keys.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">GeoDirectory does not connect to myCRED. If you award myCRED points for reviews, keep doing that in myCRED. The badges on the listing come from the listing data in GeoDirectory.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Badge for listings with 5 or more reviews<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><code>rating_count<\/code> is the number of rated reviews on the listing. &#8220;Is greater than 4&#8221; means 5 or more:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-text\">&#091;gd_dynamic_content key=&quot;rating_count&quot; condition=&quot;is_greater_than&quot; search=&quot;4&quot; html=&quot;Verified&quot;&#093;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Badge for listings rated 4 stars or more<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><code>overall_rating<\/code> is the average star rating, which can have decimals. To match an average of 4 or higher, compare against a value just under 4:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-text\">&#091;gd_dynamic_content key=&quot;overall_rating&quot; condition=&quot;is_greater_than&quot; search=&quot;3.99&quot; html=&quot;Trusted provider&quot;&#093;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Place either one in your archive item template to show it on listing cards, or in the details page template to show it on the listing itself. If you want HTML in the text, for example a styled span with a Font Awesome icon, add the element as a block or widget and type the HTML in its Text box, which is easier than putting HTML inside a shortcode attribute. More options are in the <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/core-widgets\/gd-dynamic-content\/\">GD &gt; Dynamic Content<\/a> doc.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Badges based on other fields<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">For featured, claimed or new listings, the <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/core-widgets\/gd-post-badge\/\">GD &gt; Post Badge<\/a> element is the better fit, and the shortcode builder lists every key you can use on your site. To add an icon, put the Font Awesome class in <code>icon_class<\/code>. For a &#8220;new&#8221; badge, use the <code>post_date<\/code> key with the &#8220;is less than&#8221; condition and the number of days as the value:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-text\">&#091;gd_post_badge key=&quot;post_date&quot; condition=&quot;is_less_than&quot; search=&quot;30&quot; badge=&quot;New listing&quot; icon_class=&quot;fas fa-star&quot;&#093;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Use the GD &gt; Dynamic Content block or &#091;gd_dynamic_content&#093; shortcode with the rating_count or overall_rating key. It prints your text only when the listing matches the condition you set. The GD &gt; Post Badge element cannot do this, because its field list only covers custom fields and a few post fields such as the post [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"article\/tags":[],"article\/categories":[213,422],"class_list":["post-2523","gd_place","type-gd_place","status-publish","hentry","gd_placecategory-extensions-features","gd_placecategory-core-widgets"],"_links":{"self":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2523","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article"}],"about":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/types\/gd_place"}],"author":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/comments?post=2523"}],"version-history":[{"count":1,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2523\/revisions"}],"predecessor-version":[{"id":2701,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2523\/revisions\/2701"}],"wp:attachment":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/media?parent=2523"}],"wp:term":[{"taxonomy":"gd_place_tags","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/tags?post=2523"},{"taxonomy":"gd_placecategory","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/categories?post=2523"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}