Created
November 21, 2012 15:14
-
-
Save mustardBees/4125347 to your computer and use it in GitHub Desktop.
Shortcode to retrieve a theme option within a post
This file contains 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
/** | |
* Get option shortcode | |
* | |
* Make it easy to add theme options within posts. Example usage: | |
* [get-theme-option key="contact_telephone"] | |
* | |
* @param array $theme_option Shortcode key/values | |
* @return string The value returned by get_option() | |
*/ | |
function iweb_get_option_shortcode( $theme_option ) { | |
return get_option( $theme_option['key'] ); | |
} | |
add_shortcode( 'get-theme-option', 'iweb_get_option_shortcode' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment