get_categories
get_categories — returns array of categories or false
Summary
get_categories($params);
Return Values
Array with categories or false if the categories are not found.
Usage
//get main categories for the content
$categories = get_categories('rel_type=content&parent_id=0&orderby=position asc');
//you can use the categories functuonality to for your custom data with the rel_type parameter
$modules_categories = get_categories('rel_type=modules&parent_id=0');
Parameters
You can pass parameters as string or as array.
| parameter | description | usage |
|---|---|---|
| id | the id of the category | get_categories('id=3'); |
| parent_id | the id of the parent category | get_categories('parent_id=0'); |
| rel_type | the category relation to other db table | get_categories('rel_type=content'); |
| rel_id | the item from the related db table | get_categories('rel_type=content&rel_id=5'); gets categories for the content with id 5 |
| created_by | get by author id | get_categories('created_by=1'); |
| created_at | the date of creation | strtotime compatible date |
| updated_at | the date of last edit | strtotime compatible date |
| title | Title of the category | |
| content | The html content saved in the database | |
| description | Description used for the content list | |
| position | The order position | |
| users_can_create_content | flag if users can add content in this category | "n" or "y" |