{"_id":"568507b4f72e9e0d00e09934","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"},"__v":3,"project":"5431c59ea55723080068e155","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","parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-12-31T10:47:16.956Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":4,"body":"[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php\\n\\nuse crewstyle\\\\TeaThemeOptions\\\\TeaThemeOptions;\\n\\n/**\\n * your_theme_description\\n *\\n * :::at:::package your_package\\n * @subpackage your_subpackage\\n * @since your_package_version\\n */\\n\\nif (!defined('ABSPATH')) {\\n    die('You are not authorized to directly access to this page');\\n}\\n\\n//Include composer autoload\\nrequire_once __DIR__.'/vendor/autoload.php';\\n\\n//Instanciate a new TeaThemeOptions\\n$tea = new TeaThemeOptions();\\n\\n\\n//Define an example page and build menu\\n$tea->addMenu(array(\\n    'title' => __('Example page'),\\n    'name' => __('Example page'),\\n    'slug' => 'examplepage'\\n));\\n\\n//Build contents\\nadd_filter('tto_template_examplepage_contents', 'tto_examplepage');\\nfunction tto_examplepage($contents)\\n{\\n\\treturn array(\\n    array(\\n      'type' => 'heading',\\n      'title' => __('Header.')\\n    ),\\n    array(\\n      'type' => 'radio',\\n      'title' => __('Fix the main menu bar to the top of the screen?'),\\n      'id' => 'header_menu_position',\\n      'default' => 'yes',\\n      'options' => array(\\n        'yes' => __('Yes'),\\n        'no' => __('No')\\n      )\\n    ),\\n    array(\\n      'type' => 'heading',\\n      'title' => __('Footer.')\\n    ),\\n    array(\\n      'type' => 'text',\\n      'title' => __('Copyright.'),\\n      'id' => 'footer_copyright',\\n      'default' => __('&copy; your_name, all rights reserved ~ Built with ♥ with the Tea Theme Options!')\\n    ),\\n  );\\n}\\n\\n//Build menus\\n$tea->buildMenus();\\n\\n\\n//Build post type\\n$tea_configs = array(\\n  'slug' => 'project',\\n\\n  'labels' => array(\\n    'name' => __('Projects'),\\n    'singular_name' => __('Project'),\\n  ),\\n\\n  'capability_type' => 'post',\\n  'has_archive' => true,\\n  'hierarchical' => false,\\n  'menu_icon' => 'dashicons-portfolio',\\n  'menu_position' => 5,\\n  'public' => true,\\n  'query_var' => true,\\n  'show_ui' => true,\\n\\n  'supports' => array('title', 'editor', 'excerpt', 'thumbnail', 'revision', 'comments'),\\n  'taxonomies' => array(),\\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 post type to WP\\n$tea->addPostType($tea_configs, $tea_contents);\\n//Delete variables because we love our server!\\nunset($tea_configs, $tea_contents);\\n\\n//Build post types\\n$tea->buildPostTypes();\\n\\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\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]","excerpt":"In your `functions.php`","slug":"all-in-one","type":"basic","title":"All in one"}

All in one

In your `functions.php`

[block:code] { "codes": [ { "code": "<?php\n\nuse crewstyle\\TeaThemeOptions\\TeaThemeOptions;\n\n/**\n * your_theme_description\n *\n * @package your_package\n * @subpackage your_subpackage\n * @since your_package_version\n */\n\nif (!defined('ABSPATH')) {\n die('You are not authorized to directly access to this page');\n}\n\n//Include composer autoload\nrequire_once __DIR__.'/vendor/autoload.php';\n\n//Instanciate a new TeaThemeOptions\n$tea = new TeaThemeOptions();\n\n\n//Define an example page and build menu\n$tea->addMenu(array(\n 'title' => __('Example page'),\n 'name' => __('Example page'),\n 'slug' => 'examplepage'\n));\n\n//Build contents\nadd_filter('tto_template_examplepage_contents', 'tto_examplepage');\nfunction tto_examplepage($contents)\n{\n\treturn array(\n array(\n 'type' => 'heading',\n 'title' => __('Header.')\n ),\n array(\n 'type' => 'radio',\n 'title' => __('Fix the main menu bar to the top of the screen?'),\n 'id' => 'header_menu_position',\n 'default' => 'yes',\n 'options' => array(\n 'yes' => __('Yes'),\n 'no' => __('No')\n )\n ),\n array(\n 'type' => 'heading',\n 'title' => __('Footer.')\n ),\n array(\n 'type' => 'text',\n 'title' => __('Copyright.'),\n 'id' => 'footer_copyright',\n 'default' => __('&copy; your_name, all rights reserved ~ Built with ♥ with the Tea Theme Options!')\n ),\n );\n}\n\n//Build menus\n$tea->buildMenus();\n\n\n//Build post type\n$tea_configs = array(\n 'slug' => 'project',\n\n 'labels' => array(\n 'name' => __('Projects'),\n 'singular_name' => __('Project'),\n ),\n\n 'capability_type' => 'post',\n 'has_archive' => true,\n 'hierarchical' => false,\n 'menu_icon' => 'dashicons-portfolio',\n 'menu_position' => 5,\n 'public' => true,\n 'query_var' => true,\n 'show_ui' => true,\n\n 'supports' => array('title', 'editor', 'excerpt', 'thumbnail', 'revision', 'comments'),\n 'taxonomies' => array(),\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 post type to WP\n$tea->addPostType($tea_configs, $tea_contents);\n//Delete variables because we love our server!\nunset($tea_configs, $tea_contents);\n\n//Build post types\n$tea->buildPostTypes();\n\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" } ] } [/block]