{"_id":"546e2dfe0f33a80800f58518","parentDoc":null,"__v":4,"version":{"_id":"5431c59ea55723080068e158","project":"5431c59ea55723080068e155","__v":8,"createdAt":"2014-10-05T22:26:38.927Z","releaseDate":"2014-10-05T22:26:38.927Z","categories":["5431c59ea55723080068e159","54325f53f2f806080098ad37","543264b1f2f806080098ad3e","543264c8f2f806080098ad3f","543264d3f2f806080098ad40","543264f42aca39080046d81e","5435bbf15e1b20200043834d","54e9cfb4f152c50d009b49ed"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"user":"542ea80e6b0eb6080066c9d5","category":{"_id":"54e9cfb4f152c50d009b49ed","project":"5431c59ea55723080068e155","pages":["568507b4f72e9e0d00e09934"],"version":"5431c59ea55723080068e158","__v":1,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-02-22T12:46:44.278Z","from_sync":false,"order":1,"slug":"creation","title":"Tutorial"},"project":"5431c59ea55723080068e155","updates":[],"next":{"pages":[],"description":""},"createdAt":"2014-11-20T18:07:58.422Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"basic_auth":false,"results":{"codes":[]},"settings":"","try":true,"auth":"never","params":[],"url":""},"isReference":false,"order":3,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"1. Make the Tea Theme Options working\"\n}\n[/block]\nAs we said before:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"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      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"2. Define what you want\"\n}\n[/block]\nSpecify your wanted components:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"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);\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"3. Build the Terms\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php\\n\\n//Build terms\\n$tea->buildTerms();\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"4. All in one\"\n}\n[/block]\nHere is a complete snapshot of what you have to do. Remember to make all these modifications in your `functions.php` theme file.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"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();\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]","excerpt":"Again, with a tiny example :)","slug":"create-a-custom-taxonomy","type":"basic","title":"Create a custom term"}

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]