我正在使用此代码在管理员中加载样式表,但仅在post中加载。php相关页面:
function my_enqueue_for_post_pages_only($hook) {
if( \'post.php\' != $hook )
return;
wp_register_style( \'custom_wp_admin_css_for_post_pages_only\', get_template_directory_uri() . \'/style_admin-post.css\', false, \'1.0.0\' );
wp_enqueue_style( \'custom_wp_admin_css_for_post_pages_only\' );
}
add_action( \'admin_enqueue_scripts\', \'my_enqueue_for_post_pages_only\' );
但我需要更具体地说明这个样式表的加载位置。。。
I would like to enqueue it only on 3 post.php edits screens:发布。php?post=7(&P);操作=编辑帖子。php?post=10(&;操作=编辑帖子。php?post=18(&P);操作=编辑Changing line 2 to this does not work:
if( \'post.php?post=7&action=edit\' != $hook )
是否有可能对
admin_enqueue_scripts 钩