Last active
June 8, 2017 16:16
-
-
Save Cheslab/5b71d2613ea35985846769f189934a41 to your computer and use it in GitHub Desktop.
wordpress plugin admin page style external file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In order to use an external css file in the plugin's admin panel: | |
// 1. Copy following code to the main php file of your plugin (plugins/your_plugin/your_plugin_name.php) | |
// 2. Create admin.css (or adjust the name below) | |
function plugin_name_admin_css() | |
{ | |
$siteurl = get_option('siteurl'); | |
$url = $siteurl . '/wp-content/plugins/' . basename(dirname(__FILE__)) . '/admin.css'; | |
echo "<link rel='stylesheet' type='text/css' href='$url' />\n"; | |
} | |
add_action('admin_head', 'plugin_name_admin_css'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment