---
agentTools:
  projectIndex: https://olympus.readme.io/llms.txt
---

# Create a custom term

Again, with a tiny example :)

[block:api-header]
{
  "type": "basic",
  "title": "1. Make the Tea Theme Options working"
}
[/block]

As we said before:

[block:code]
{
  "codes": [
    {
      "code": "<?php\n\nuse crewstyle\\TeaThemeOptions\\TeaThemeOptions;\n\n//Include composer autoload\nrequire_once __DIR__.'/vendor/autoload.php';\n\n//Instanciate a new TeaThemeOptions\n$tea = new TeaThemeOptions();",
      "language": "php"
    }
  ]
}
[/block]

[block:api-header]
{
  "type": "basic",
  "title": "2. Define what you want"
}
[/block]

Specify your wanted components:

[block:code]
{
  "codes": [
    {
      "code": "<?php\n\n//Build term\n$tea_configs = array(\n  'slug' => 'project-category',\n  'post_type' => array('project'),\n\n  'labels' => array(\n    'name' => __('Categories'),\n    'singular_name' => __('Category'),\n  ),\n\n  'hierarchical' => true,\n  'query_var' => true,\n  'rewrite' => 'project-category',\n  'show_admin_column' => true,\n);\n//Build contents\n$tea_contents = array(\n  array(\n    'type' => 'textarea',\n    'id' => 'source',\n    'title' => 'Video URL',\n    'placeholder' => 'http://...',\n    'description' => 'Enter here your Video URL.'\n  )\n);\n\n//Add term to WP\n$tea->addTerm($tea_configs, $tea_contents);\n//Delete variables because we love our server!\nunset($tea_configs, $tea_contents);",
      "language": "php"
    }
  ]
}
[/block]

[block:api-header]
{
  "type": "basic",
  "title": "3. Build the Terms"
}
[/block]

[block:code]
{
  "codes": [
    {
      "code": "<?php\n\n//Build terms\n$tea->buildTerms();",
      "language": "php"
    }
  ]
}
[/block]

[block:api-header]
{
  "type": "basic",
  "title": "4. All in one"
}
[/block]

Here is a complete snapshot of what you have to do. Remember to make all these modifications in your `functions.php` theme file.

[block:code]
{
  "codes": [
    {
      "code": "<?php\n\nuse crewstyle\\TeaThemeOptions\\TeaThemeOptions;\n\n//Include composer autoload\nrequire_once __DIR__.'/vendor/autoload.php';\n\n//Instanciate a new TeaThemeOptions\n$tea = new TeaThemeOptions();\n\n//Build term\n$tea_configs = array(\n  'slug' => 'project-category',\n  'post_type' => array('project'),\n\n  'labels' => array(\n    'name' => __('Categories'),\n    'singular_name' => __('Category'),\n  ),\n\n  'hierarchical' => true,\n  'query_var' => true,\n  'rewrite' => 'project-category',\n  'show_admin_column' => true,\n);\n//Build contents\n$tea_contents = array(\n  array(\n    'type' => 'textarea',\n    'id' => 'source',\n    'title' => 'Video URL',\n    'placeholder' => 'http://...',\n    'description' => 'Enter here your Video URL.'\n  )\n);\n\n//Add term to WP\n$tea->addTerm($tea_configs, $tea_contents);\n//Delete variables because we love our server!\nunset($tea_configs, $tea_contents);\n\n//Build terms\n$tea->buildTerms();",
      "language": "php"
    }
  ]
}
[/block]