Skip to content

Instantly share code, notes, and snippets.

@joshlevinson
Forked from dongilbert/option_tree_shortcode.php
Last active August 29, 2015 13:57
Show Gist options
  • Save joshlevinson/9791661 to your computer and use it in GitHub Desktop.
Save joshlevinson/9791661 to your computer and use it in GitHub Desktop.
<?php
/**
* Shortcode to go along with my Option Tree
* helper functions. See those here:
* https://gist.github.com/2627998
*
* <samp>[theme_option name="home_text"]</samp>
*
* @param array Array of attributes passed from the shortcode.
* @return string|null
*/
if(function_exists('ot_get_option'))
{
add_shortcode('theme_option', 'theme_option_shortcode');
function theme_option_shortcode($atts)
{
extract(shortcode_atts(array(
'name' => null
), $atts));
if($name !== null)
{
$name = ot_get_option($name);
}
return $name;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment