Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 我的排队脚本和css没有';我不在WordPress工作_Php_Wordpress - Fatal编程技术网

Php 我的排队脚本和css没有';我不在WordPress工作

Php 我的排队脚本和css没有';我不在WordPress工作,php,wordpress,Php,Wordpress,我正在尝试为WordPress的教程创建一些管理页面。我添加了标准的css和js文件,其功能是wp\u enqueue\u样式。它起作用了,但在enqueue.php文件中,命令不起作用 enqueue.php中的我的代码: <?php function theme_load_admin_scripts($hook){ if('toplevel_page_theme_option' != $hook){ return; } wp_register_style('theme_adm

我正在尝试为WordPress的教程创建一些管理页面。我添加了标准的
css
js
文件,其功能是
wp\u enqueue\u样式
。它起作用了,但在
enqueue.php
文件中,命令不起作用

enqueue.php
中的我的代码:

<?php
function theme_load_admin_scripts($hook){
if('toplevel_page_theme_option' != $hook){
    return;
}

wp_register_style('theme_admin', get_template_directory_uri() . '/css/theme.admin.css', array(), '1.0.0', 'all');
wp_enqueue_style('theme_admin');

wp_enqueue_media();

wp_register_script('theme-admin-script', get_template_directory_uri() . '/inc/js/theme.admin.js', array('jquery'), '1.0.0', true);
wp_enqueue_script('theme-admin-script');
}

add_action('admin_enqueue_scripts', 'theme_load_admin_scripts');
?>

使用admin\u init

add_action('admin_init', 'theme_load_admin_scripts');

非常感谢。我已经修好了。