Skip to content

Instantly share code, notes, and snippets.

@mustardBees
Created November 21, 2012 15:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mustardBees/4125347 to your computer and use it in GitHub Desktop.
Save mustardBees/4125347 to your computer and use it in GitHub Desktop.
Shortcode to retrieve a theme option within a post
/**
* 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