admin管理员组文章数量:1122846
I am learning WordPress Plugin development. I would like to load my specific CSS file in my specific Admin Pages not in other Admin Pages.
How can I do that ?
I am learning WordPress Plugin development. I would like to load my specific CSS file in my specific Admin Pages not in other Admin Pages.
How can I do that ?
Share Improve this question asked Sep 7, 2024 at 6:00 FoysalFoysal 4451 gold badge5 silver badges15 bronze badges1 Answer
Reset to default 2/**
* Enqueue a script or stylesheet in the WordPress admin on edit.php.
*
* @param string $hook_suffix Hook suffix for the current admin page.
*/
function wpse426722_admin_enqueue( $hook_suffix ) {
if( 'admin_print_scripts-profile' == $hook_suffix ) {
wp_enqueue_style( 'your-stylesheet-slug', '/path/to/your_stylesheet.css' );
}
}
add_action( 'admin_enqueue_scripts', 'wpse426722_admin_enqueue' );
The above function has the hook suffix for when you're viewing your profile, you'll need to replace it with the hook suffix for whatever page you're targeting.
本文标签: plugin developmentLoad specific CSS file
版权声明:本文标题:plugin development - Load specific CSS file 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736294975a1929471.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论