Category Terms¶
Functions for working with listing category terms (the individual values within a category, e.g. "Toyota" within a "Make" category).
Functions¶
dms_add_category_term( array $term_data ): int|bool¶
Creates a new term within a listing category. Returns the new term ID on success, false on failure.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$term_data |
array |
- | Term data. Required keys: value (the term string), cat_id (the category ID), total (initial listing count). |
Returns - int\|bool
Example
dms_get_term_options( ?Category $category = null ): array¶
Returns the registered option field definitions for category terms, optionally scoped to a specific category.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$category |
?DMS\Listing\Category |
null |
Optional category to scope the options to |
Returns - array
Example
$options = dms_get_term_options();
// Scoped to a specific category
$category = dms_get_category( 3 );
$options = dms_get_term_options( $category );
dms_add_category_term_tab( array $tab_data ): void¶
Registers a custom options tab that appears on the category term edit page.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$tab_data |
array |
- | Tab definition including id, title, icon, and fields keys |
Returns - void
Example