我想注册一个脚本与wordpress,将在后端工作。我以为我在functions.php文件中注册的任何脚本都可以工作,但它只在前端显示。有谁知道怎么做吗?
发布于 2012-03-30 21:15:32
尝试:
<?php
add_action( 'admin_head', 'myscriptinthe_admin_header' );
function myscriptinthe_admin_header(){
echo "<script>alert( 'in the admin head!' )</script>";
}
add_action( 'admin_head', function(){ ?>
<script> alert( 'in the admin head!' ) </script>
<?php }); ?>发布于 2012-11-20 16:31:30
除了上面的答案,有时我们可能需要将javascript添加到WordPress管理后端的页脚,而不是头部。
在本例中,我们将使用'admin_footer‘钩子而不是'admin_head’。
https://stackoverflow.com/questions/9943490
复制相似问题