• Resolved costintrifan

    (@costintrifan)


    I’m currently working on a plugin and I cannot add a stylesheet to the plugin page I’m currently working on.

    At the moment I’m using javascript to dynamically load the stylesheet but this is not the right choice so I need to know how to add that stylesheet into that plugin file. I’ve tried using the add_action(‘wp_head’, ‘func’); where the function func will return the stylesheet but for some reasons it didn’t work..?

    Thank you in advance

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’m having the same problem. Is there a WordPress function to include a stylesheet in the options page?

    Just in case anyone else had this problem, I just figured it out. To get this to work for the admin panel page, you have to use the admin_head hook instead of wp_head, e.g. add_action(‘admin_head’, ‘func’);

    The downside to this is that it styles not only your plugin’s page, but all the other admin panel pages as well. But this shouldn’t be a problem if your css styles only apply to the elements on your plugin’s admin panel page.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Adding a stylesheet to a plugin’ is closed to new replies.