$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>Is it possible to load the css just on my plugin admin page?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Is it possible to load the css just on my plugin admin page?

matteradmin9PV0评论

I am trying to build a wp plugin using vuejs and the bulma css framework, but it seems like it is having an impact on the whole admin area.

Is it possible to load my css only on my plugin admin page?

I am trying to build a wp plugin using vuejs and the bulma css framework, but it seems like it is having an impact on the whole admin area.

Is it possible to load my css only on my plugin admin page?

Share Improve this question edited Dec 17, 2018 at 21:58 Dan Gayle 6,1665 gold badges33 silver badges45 bronze badges asked Dec 15, 2018 at 14:14 fefefefe 8943 gold badges14 silver badges34 bronze badges 1
  • Did you read the documentation ? codex.wordpress/Plugin_API/Action_Reference/… – shanebp Commented Dec 15, 2018 at 20:59
Add a comment  | 

1 Answer 1

Reset to default 1

To answer the question, from the codex, listed above in the comments.

function load_custom_wp_admin_style($hook) {
        // Load only on ?page=mypluginname
        if($hook != 'toplevel_page_mypluginname') {
                return;
        }
        wp_enqueue_style( 'custom_wp_admin_css', plugins_url('admin-style.css', __FILE__) );
}
add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_style' );

Note: If you are unsure what your $hook name is .. use this to determine your hookname. Put the code after the { from the function.

wp_die($hook);
Post a comment

comment list (0)

  1. No comments so far