Skip to content

DMS Function Reference

Developer-facing PHP functions available in the DMS plugin. Functions are grouped by domain. Each page documents parameters, return types, and usage examples.


Function Groups

Listings

Core functions for retrieving and setting the active listing.

Function Description
dms_get_listing( $id ) Get a single listing object by ID
dms_get_all_listings( $args ) Get all listings for the current type
dms_get_current_listing() Get the listing active in the current loop context
dms_get_current_listing_id() Get the ID of the current listing
dms_set_current_listing( $listing ) Set the active listing in context
dms_reset_current_listing() Reset context to the main query listing

Listing Query

Functions for interacting with the active listing query and its filters.

Function Description
dms_listing_query() Get the Query singleton
dms_get_total_listings() Get total found listings count
dms_get_listing_query() Get the underlying WP_Query object
dms_set_listing_query( $args ) Override the listing query args
dms_get_selected_terms() Get currently active filter terms
dms_add_listing_filter( $category, $term ) Add a programmatic filter to the query

Listing Types

Functions for working with inventory types.

Function Description
dms_get_type( $id ) Get a type by ID or slug
dms_get_types() Get all registered inventory types
dms_get_current_type() Detect and return the current type from context
dms_set_current_type( $type_id ) Force a specific type as current
dms_add_type( $type_data ) Create a new inventory type
dms_is_dms_post_type( $post_type ) Check if a post type belongs to DMS
dms_add_type_tab( $tab_data ) Register a custom options tab for types
dms_get_type_options() Get all registered type option fields

Listing Categories

Functions for working with listing categories.

Function Description
dms_get_category( $category ) Get a category by ID or slug
dms_get_all_categories( $args ) Get all categories, optionally filtered
dms_add_category( $category_data ) Create a new listing category
dms_delete_category( $category_id ) Delete a category and its terms
dms_get_current_category() Get the category being edited
dms_add_category_tab( $tab_data ) Register a custom tab on category settings
dms_add_filterable_category_data( $category ) Register a category as filterable
dms_get_filterable_category_data() Get all registered filterable categories

Category Terms

Functions for working with listing category terms.

Function Description
dms_add_category_term( $term_data ) Create a new term within a category
dms_get_term_options( $category ) Get registered term option fields
dms_add_category_term_tab( $tab_data ) Register a custom tab on the term edit page

Options

Register custom metaboxes on DMS admin edit screens.

Function Description
dms_register_metabox( $metabox_data ) Register a metabox (call on dms_init)

Cache

Functions for reading, writing, and clearing the DMS object cache.

Function Description
dms_cache_get( $key, $group ) Retrieve a cached value
dms_cache_set( $key, $data, $expire, $group ) Store a value in cache
dms_cache_delete( $key, $group ) Remove a cached value
dms_cache_clear() Clear all site/server caches
dms_clear_post_cache( $post_id ) Clear cache for a single listing

Low-level functions for reading and writing listing image post meta.

Function Description
dms_get_main_image( $listing_id ) Get the main image attachment ID
dms_set_main_image( $listing_id, $image_id ) Set the main image
dms_remove_main_image( $listing_id ) Remove the main image
dms_set_gallery_images( $listing_id, $data ) Set gallery image data
dms_remove_gallery_images( $listing_id ) Remove all gallery images

Statuses

Functions for working with listing statuses.

Function Description
dms_get_status( $status_id ) Get a listing status object

Badges

Functions for working with listing badges.

Function Description
dms_get_badge( $id ) Get a badge by ID or text
dms_get_type_badges( $type_id ) Get all badges for a type
dms_add_type_badge( $badge_data ) Create a new badge
dms_delete_badge( $id ) Delete a badge
dms_get_badge_options() Get registered badge option fields

Leads

Functions for working with customer leads.

Function Description
dms_get_lead( $lead_id ) Get a single lead
dms_get_all_leads( $type_id ) Get all leads for a type
dms_count_all_leads( $type_id ) Count leads for a type
dms_get_leads_for_listing( $listing_id ) Get all leads for a listing (post ID)
dms_get_follow_up_leads() Get leads due for follow-up in 7 days
dms_get_lead_outcomes() Get available lead outcome options
dms_get_lead_statuses() Get available lead status options

Object Reference

Functions in this reference return typed objects. The following pages document the available methods on each object.

Object Description
Listing A single inventory listing
Type An inventory type (e.g. Vehicles, Boats)
Category A listing category (e.g. Make, Model)
Badge A listing badge
Lead A customer lead/enquiry
Listing_Status A listing status