
Directorist - Custom Badges
A Directorist extension that allows you to create and manage custom badges for your listings with advanced conditions.
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.
| Requirement | Minimum Version / Status |
|---|---|
| WordPress | 5.2 or higher |
| PHP | 7.4 or higher |
| Directorist Plugin | Installed 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.
| Field | Required | Description |
|---|---|---|
Badge Title | Yes | Internal name, only visible in the admin. Example: Featured Listing Badge |
Badge ID | Yes | Unique machine-readable identifier. Use lowercase letters and hyphens only. Example: featured-listing-badge |
Badge Label | Yes | The text displayed on the badge on a listing. Example: Featured |
Icon | No | Optional icon class or name displayed alongside the badge label. |
CSS Class | No | Optional custom CSS classes for styling the badge. |
Color | No | Optional 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.
- Click Add Condition in the Conditions panel. A new condition row appears.
- Select Meta Field from the condition type dropdown.
- Enter the meta field key — the exact key you want to evaluate. Example:
_listing_price - Choose an operator — how the field value should be compared. See the Operator Reference section below for all options.
- Enter a comparison value — the value to compare against. Example:
100,featured,yes. Leave blank when usingEXISTSorNOT EXISTS. - Select a cast type — how the field value is interpreted before comparing. Example:
NUMERICfor numbers,DATEfor dates,CHARfor 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.
- Click Add Condition in the Conditions panel.
- Select Pricing Plan from the condition type dropdown.
- Choose one of the two sub-types:
| Sub-type | When to use it |
|---|---|
| User Active Plan | Show the badge when the listing owner currently has a specific active pricing plan. |
| Listing Has Plan | Show 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.
| Logic | Behaviour |
|---|---|
| AND | All conditions must be true for the badge to show. Use this for precise, targeted badges. |
| OR | Any 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.
- Export — Click Export on the Custom Badges screen. A JSON file containing all your badge configurations will be downloaded to your computer.
- 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
| Operator | What 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. |
LIKE | Field value contains the given string (partial match). |
NOT LIKE | Field value does not contain the given string. |
IN | Field value matches one value from a comma-separated list. |
NOT IN | Field value does not match any value in a comma-separated list. |
EXISTS | The meta field exists on this listing (any value). No comparison value needed. |
NOT EXISTS | The 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 Type | Interprets the value as |
|---|---|
CHAR | Plain text / string (default). |
NUMERIC | A whole number (integer). |
DECIMAL | A decimal number. Example: 9.99 |
DATE | A date in YYYY-MM-DD format. |
DATETIME | A date and time in YYYY-MM-DD HH:MM:SS format. |
BOOLEAN | True (1) or false (0 / empty). |
Security
This extension follows WordPress security best practices throughout.
| Practice | Details |
|---|---|
| Input Sanitization | All user inputs are sanitized and validated before being saved to the database. |
| Nonce Verification | All AJAX requests are protected with WordPress nonce verification. |
| Capability Checks | Admin-only functions require the appropriate WordPress user capabilities. |
| Output Escaping | All data is properly escaped before being rendered in the browser. |
| SQL Injection Prevention | All database queries use WordPress APIs to prevent SQL injection attacks. |
Related Products
Directorist - Advanced Social Links
An extension for Directorist plugin that adds advanced social networking options to listing forms and single listing pages.
Directorist - Custom Map Styles
A Directorist extension enabling custom Google Maps styling, letting users override default map designs with personalized configurations.
Directorist - Nearby Amenities
A powerful extension for Directorist that displays nearby amenities on single listing pages using Google Places API only.


