Shortcodes
Community Listings provides four shortcodes for displaying and submitting listings. Each shortcode accepts attributes to control the output.
[cl_listings]
Displays a filtered list of listings. This is the primary display shortcode for showing visual or structured listings on any page.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
type | string | "" (all) | Filter by listing type: visual or structured |
category | string | "" (all) | Filter by category slug, e.g. food-dining, health-wellness |
columns | int | 3 | Number of columns in the grid (1–6). Only applies to visual listings. |
per_page | int | 12 | Number of listings to display per page. Set to -1 to show all. |
orderby | string | date | Sort field: date, title, menu_order, rand |
order | string | DESC | Sort direction: ASC or DESC |
Examples
Display all visual food listings in a 3-column grid:
[cl_listings type="visual" category="food-dining" columns="3" per_page="12"] Display structured health & wellness listings:
[cl_listings type="structured" category="health-wellness" per_page="20"] Display all listings sorted by title:
[cl_listings orderby="title" order="ASC"] [cl_listing_grid]
An auto-detecting grid that renders both visual and structured listings in a single output. It groups listings by type and renders each with the appropriate template — image cards for visual listings and text rows for structured listings.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
columns | int | 3 | Number of columns for the visual listings grid |
per_page | int | 12 | Total number of listings to show per page |
show_headings | bool | true | Whether to display section headings for each listing type |
Example
[cl_listing_grid columns="4" per_page="24"] [cl_submit_form]
Renders the frontend submission form for logged-in users. The form fields automatically adapt based on the selected category: visual categories show an image upload field, while structured categories emphasize contact information.
If the user is not logged in, a login prompt is displayed instead.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
category | string | "" (user selects) | Pre-select a category. When set, the category dropdown is hidden. |
redirect | string | "" | URL to redirect to after successful submission. Defaults to the current page with a success message. |
Examples
General submission form where the user selects the category:
[cl_submit_form] Pre-filtered form for a specific category:
[cl_submit_form category="food-dining"] Redirect after submission:
[cl_submit_form redirect="/thank-you/"] Submission Form Fields
The form displayed by [cl_submit_form] includes these fields, depending on the selected category:
| Field | Visual Categories | Structured Categories | Required |
|---|---|---|---|
| Title | Yes | Yes | Yes |
| Description | Yes | Yes | Yes |
| Category | Yes | Yes | Yes |
| Featured Image | Yes | No | No |
| Address | Yes | Yes | No |
| Phone | Yes | Yes | No |
| Yes | Yes | No | |
| Website | Yes | Yes | No |
[cl_my_listings]
Displays a table of the logged-in member's own listings with status, edit, and delete functionality. If the user is not logged in, a login prompt is shown.
What members see
| Column | Description |
|---|---|
| Title | Listing name (linked if published) |
| Category | Which category the listing belongs to |
| Status | Badge: Live (green), Pending (yellow), or Draft (gray) |
| Date | When the listing was submitted |
| Actions | Edit (opens modal) and Delete (with confirmation) |
Example
[cl_my_listings] Place this on a page called "My Listings" so members can manage their submissions.
Features
- Members can only see, edit, and delete their own listings
- Edit opens a modal with all fields pre-filled
- Delete requires confirmation
- All actions are AJAX-powered (no page reload)
- Admins can edit/delete any listing
Category Slugs Reference
Use these slugs in the category attribute:
| Category | Slug | Listing Type |
|---|---|---|
| Food & Dining | food-dining | Visual |
| Events | events | Visual |
| Leisure Activities | leisure-activities | Visual |
| Crafts & Maintenance | crafts-maintenance | Structured |
| Health & Wellness | health-wellness | Structured |
| Shops & Market | shops-market | Structured |
| Services | services | Structured |
CSS Classes
All shortcode output is wrapped in scoped CSS classes to prevent conflicts with your theme:
.cl-listings-wrap— outer wrapper for all listing output.cl-listing-card— individual visual listing card.cl-listing-row— individual structured listing row.cl-submit-wrap— wrapper for the submission form.cl-grid— the CSS Grid container
Gutenberg Block Equivalents
Every shortcode has a corresponding Gutenberg block with a visual editor interface:
| Shortcode | Block Name |
|---|---|
[cl_listings] / [cl_listing_grid] | community-listings/listings-grid |
[cl_submit_form] | community-listings/submit-form |