Directorist - Custom Badges

A Directorist extension that allows you to create and manage custom badges for your listings with advanced conditions.

$0.00
Buy Now

Overview

Directorist Custom Badges extends the Directorist plugin with a full badge management system. Assign custom labels, icons, colors, and CSS classes to each badge, then configure conditions to control exactly when each badge appears on a listing.

With this extension you can:

  • Create unlimited custom badges with your own labels, icons, colors, and CSS classes
  • Show badges automatically when a listing meets your configured conditions
  • Combine multiple conditions using AND / OR logic
  • Enable, disable, or reorder badges at any time without deleting them
  • Import and export your badge configurations between sites

Requirements

Make sure your environment meets the following before installing.

RequirementMinimum Version / Status
WordPress5.2 or higher
PHP7.4 or higher
Directorist PluginInstalled and active

Installation

Step 1 — Upload the plugin folder

Upload the directorist-custom-badge folder to your /wp-content/plugins/ directory via FTP or the WordPress file manager.

Step 2 — Activate the plugin

Go to WordPress Admin → Plugins. Find Directorist Custom Badges in the list and click Activate.

Step 3 — Open Custom Badges

In your WordPress admin sidebar, navigate to Directorist → Custom Badges. You are ready to create your first badge.


Badge Builder

The Badge Builder is where you create and configure each badge. Go to Directorist → Custom Badges and click Add New Badge to open it.


Step 1 — Open the Badge Builder

From the Custom Badges screen, click Add New Badge in the top-right corner. The Badge Builder opens with two main panels: Badge Details and Conditions.

Note: You can return to this screen at any time to edit, reorder, or toggle badges on and off.


Step 2 — Fill in Badge Details

Complete the fields in the Badge Details panel at the top of the builder.

FieldRequiredDescription
Badge TitleYesInternal name, only visible in the admin. Example: Featured Listing Badge
Badge IDYesUnique machine-readable identifier. Use lowercase letters and hyphens only. Example: featured-listing-badge
Badge LabelYesThe text displayed on the badge on a listing. Example: Featured
IconNoOptional icon class or name displayed alongside the badge label.
CSS ClassNoOptional custom CSS classes for styling the badge.
ColorNoOptional hex color value for the badge background or text.

Step 3 — Add Conditions

Conditions control when a badge appears. A badge is only shown on a listing that satisfies the conditions you define. There are two condition types: Meta Field and Pricing Plan.

Important: If you add no conditions, the badge will appear on every listing. Add at least one condition to restrict when it is displayed.

Meta Field Conditions

Use these to show a badge based on the value of a custom field (meta key) on the listing.

  1. Click Add Condition in the Conditions panel. A new condition row appears.
  2. Select Meta Field from the condition type dropdown.
  3. Enter the meta field key — the exact key you want to evaluate. Example: _listing_price
  4. Choose an operator — how the field value should be compared. See the Operator Reference section below for all options.
  5. Enter a comparison value — the value to compare against. Example: 100, featured, yes. Leave blank when using EXISTS or NOT EXISTS.
  6. Select a cast type — how the field value is interpreted before comparing. Example: NUMERIC for numbers, DATE for dates, CHAR for plain text.

Pricing Plan Conditions

Use these to show a badge based on the pricing plan of the listing owner or the plan assigned to the listing.

  1. Click Add Condition in the Conditions panel.
  2. Select Pricing Plan from the condition type dropdown.
  3. Choose one of the two sub-types:
Sub-typeWhen to use it
User Active PlanShow the badge when the listing owner currently has a specific active pricing plan.
Listing Has PlanShow the badge when the listing itself is assigned to a specific pricing plan.

Step 4 — Set Condition Logic

When you have more than one condition, use the Condition Relation setting to control how they are evaluated together.

LogicBehaviour
ANDAll conditions must be true for the badge to show. Use this for precise, targeted badges.
ORAny one condition being true is enough for the badge to show. Use this for broader, catch-all badges.

Step 5 — Save the Badge

Once you have filled in all badge details and configured your conditions, click Save Badge to store your badge.

Tip: After saving, your badge is immediately active. It will appear on any listing that matches your conditions. See the next section to learn how to disable a badge without deleting it.


Managing Your Badges

Enable or Disable a Badge

Each badge in the list has an Active / Inactive toggle. Switch it off to hide the badge from all listings without losing its configuration. Switch it back on at any time to re-activate it.

Reorder Badges

Badges are displayed in the order shown in the list. To change the order, drag a badge row by its handle on the left side and drop it in the desired position.

Import and Export

Back up your badge configurations or move them between sites using the Import / Export feature on the Custom Badges screen.

  1. Export — Click Export on the Custom Badges screen. A JSON file containing all your badge configurations will be downloaded to your computer.
  2. Import — On the target site, click Import and select the previously exported JSON file. Badges will be merged with any existing ones.

Note: Importing merges badges with existing ones. It does not overwrite badges that already have the same Badge ID.


Operator Reference

Use these operators when configuring Meta Field conditions.

Comparison Operators

OperatorWhat it does
=Field value exactly equals the given value.
!=Field value does not equal the given value.
>Field value is greater than the given value.
>=Field value is greater than or equal to the given value.
<Field value is less than the given value.
<=Field value is less than or equal to the given value.
LIKEField value contains the given string (partial match).
NOT LIKEField value does not contain the given string.
INField value matches one value from a comma-separated list.
NOT INField value does not match any value in a comma-separated list.
EXISTSThe meta field exists on this listing (any value). No comparison value needed.
NOT EXISTSThe meta field does not exist on this listing. No comparison value needed.

Cast Types

Cast types tell the plugin how to interpret the field’s value before comparing it.

Cast TypeInterprets the value as
CHARPlain text / string (default).
NUMERICA whole number (integer).
DECIMALA decimal number. Example: 9.99
DATEA date in YYYY-MM-DD format.
DATETIMEA date and time in YYYY-MM-DD HH:MM:SS format.
BOOLEANTrue (1) or false (0 / empty).

Security

This extension follows WordPress security best practices throughout.

PracticeDetails
Input SanitizationAll user inputs are sanitized and validated before being saved to the database.
Nonce VerificationAll AJAX requests are protected with WordPress nonce verification.
Capability ChecksAdmin-only functions require the appropriate WordPress user capabilities.
Output EscapingAll data is properly escaped before being rendered in the browser.
SQL Injection PreventionAll database queries use WordPress APIs to prevent SQL injection attacks.

Related Products

Directorist - Custom Map Styles

Directorist - Custom Map Styles

A Directorist extension enabling custom Google Maps styling, letting users override default map designs with personalized configurations.

Directorist - Nearby Amenities

Directorist - Nearby Amenities

A powerful extension for Directorist that displays nearby amenities on single listing pages using Google Places API only.

More Reading

Post navigation