{"_id":"54483f7bcfb4580800d5e2a8","category":{"_id":"543264d3f2f806080098ad40","project":"5431c59ea55723080068e155","version":"5431c59ea55723080068e158","pages":["543249453ee609080061800c","543f96e4051bdc0e00dfbf09","54324b909afb2a080013cce0","54359c9e5e1b202000438229","54483f7bcfb4580800d5e2a8","546e2dfe0f33a80800f58518","56850afe65976e0d00001c9b"],"__v":8,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-10-06T09:45:55.706Z","from_sync":false,"order":2,"slug":"how-to","title":"How-to"},"project":"5431c59ea55723080068e155","__v":2,"user":"542ea80e6b0eb6080066c9d5","parentDoc":null,"is_link":false,"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"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2014-10-22T23:36:27.296Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"try":true,"basic_auth":false,"auth":"never","params":[],"url":""},"isReference":false,"order":0,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Goodbye `get_option`. Welcome `get_option`\"\n}\n[/block]\nThere are two ways to access to the stored options:\n+ the classical `get_option` Wordpress function which needs the option name as a parameter ([read the doc ;)](http://codex.wordpress.org/Function_Reference/get_option))\n+ the new `get_option` TeaThemeOptions function which has been upgraded to use the transient API if asked.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Get option in the theme\"\n}\n[/block]\nInstead of using `get_option`, you can use:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php\\n\\n$my_value = TeaThemeOptions::get_option('my_value', 'default_value');\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\nBut writing `TeaThemeOptions::get_option` is pretty long, right? That's why we suggest you to add these lines in your `functions.php`, after the Tea Theme Options declaration:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php\\n\\nfunction _get_option($option, $default = '', $transient = false)\\n{\\n    return TeaThemeOptions::get_option($option, $default, $transient);\\n}\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\nYou can now access to your options through:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php\\n\\n$my_value = _get_option('my_value', 'default_value');\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]","excerpt":"In your theme","slug":"get-your-options","type":"basic","title":"Get your options"}

Get your options

In your theme

[block:api-header] { "type": "basic", "title": "Goodbye `get_option`. Welcome `get_option`" } [/block] There are two ways to access to the stored options: + the classical `get_option` Wordpress function which needs the option name as a parameter ([read the doc ;)](http://codex.wordpress.org/Function_Reference/get_option)) + the new `get_option` TeaThemeOptions function which has been upgraded to use the transient API if asked. [block:api-header] { "type": "basic", "title": "Get option in the theme" } [/block] Instead of using `get_option`, you can use: [block:code] { "codes": [ { "code": "<?php\n\n$my_value = TeaThemeOptions::get_option('my_value', 'default_value');", "language": "php" } ] } [/block] But writing `TeaThemeOptions::get_option` is pretty long, right? That's why we suggest you to add these lines in your `functions.php`, after the Tea Theme Options declaration: [block:code] { "codes": [ { "code": "<?php\n\nfunction _get_option($option, $default = '', $transient = false)\n{\n return TeaThemeOptions::get_option($option, $default, $transient);\n}", "language": "php" } ] } [/block] You can now access to your options through: [block:code] { "codes": [ { "code": "<?php\n\n$my_value = _get_option('my_value', 'default_value');", "language": "php" } ] } [/block]