Created
June 20, 2014 03:21
-
-
Save nakakaz11/cc99e663750074a4c215 to your computer and use it in GitHub Desktop.
Wordpress functions.php内で使っている変数をJSで使いたいとき ref: http://qiita.com/nakakaz11/items/b67de932a6979f60425f
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
function functionsInfoToJs() { | |
get_currentuserinfo(); | |
global $user_level; | |
echo '<script type="text/javascript">var _g_user_level = "' . $user_level . '";</script>'; // JS内はよしなに | |
} | |
// 管理画面内に出力 | |
//add_action( 'admin_print_scripts', 'functionsInfoToJs' ); | |
// 全体の画面内に出力 | |
add_action( 'wp_print_scripts', 'functionsInfoToJs' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment