-
-
Save 6arshid/52939093a6127baace71a387b7a96286 to your computer and use it in GitHub Desktop.
Building a WordPress Plugin Admin Menu Page
This file contains 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
<?php | |
add_action('admin_menu', 'plugin_admin_add_page'); | |
function plugin_admin_add_page() { | |
//http://codex.wordpress.org/Function_Reference/add_menu_page | |
add_menu_page( 'custom menu title', 'custom menu', 'manage_options', 'dbexplorer/adminpage.php'); | |
} | |
function my_enqueue($hook) { | |
//only for our special plugin admin page | |
if( 'dbexplorer/adminpage.php' != $hook ) | |
return; | |
wp_register_style('dbexplorer', plugins_url('dbexplorer/pluginpage.css')); | |
wp_enqueue_style('dbexplorer'); | |
wp_enqueue_script('pluginscript', plugins_url('pluginpage.js', __FILE__ ), array('jquery')); | |
} | |
add_action( 'admin_enqueue_scripts', 'my_enqueue' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment