Created
June 4, 2012 18:53
-
-
Save dongilbert/2870164 to your computer and use it in GitHub Desktop.
Shortcode for WP Option Tree
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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('get_theme_option') | |
{ | |
add_shortcode('theme_option', 'theme_option_shortcode'); | |
function theme_option_shortcode($atts) | |
{ | |
extract(shortcode_atts(array( | |
'name' => null | |
), $atts)); | |
if($name !== null) | |
{ | |
$name = get_theme_option($name); | |
} | |
return $name; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment