Skip to content

Instantly share code, notes, and snippets.

@BeFiveINFO
Created March 17, 2016 09:50
Show Gist options
  • Save BeFiveINFO/23407e981e3120c22457 to your computer and use it in GitHub Desktop.
Save BeFiveINFO/23407e981e3120c22457 to your computer and use it in GitHub Desktop.
Using get_theme_mod() so that it works in Customizer live preview
<?php
// for example, in your functions.php or anywhere in your theme
// Use wp_loaded action hook
add_action( 'wp_loaded', 'get_my_options' );
function get_my_options() {
define('MY_OPTION',get_theme_mod('my_option', FALSE));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment