Tag Archives: plugin

wordpress: add css file for your plugin admin page only

If you want to add a css file that is loaded only when your plugin admin page is displayed, here is how to do it: Step 1: attach to appropriate hook: add_action(‘admin_enqueue_scripts’, ‘myplugin_loadAdminCss’); Step 2: inside your hooked function, filter on provided parameter: function myplugin_loadAdminCss($hook) {         if ((‘plugins_page_XXX’) != $hook) { return; } wp_register_style(‘myplugin_admin_css’, plugins_url(‘/css/admin.css’, __FILE__), false, ‘1.0.0); } Key here is to filter on value provided to your function (named $hook here). This value corresponds to the admin page being currently displayed, with a special value when this page is the “plugins.php” page where $hook is ‘plugins_page_XXX’ […]

jquery plugins: popup message

Here are some great jquery plugins for showing up popup messages: http://akquinet.github.com/jquery-toastmessage-plugin/ http://needim.github.com/noty/  

wordpress plugin admin pages – infinite loop on login page

While writing a wordpress plugin with several admin pages (at least pages for identified users) I ran into the following issue: Upon every successful login, my page content was not displayed and user was redirected to login screen in what seemed to be a never ending loop. After lengthy debugging, reason for this was that after login, I redirected my user to a custom short url which did not start with ‘wp-admin/xxxx’. Then in my page being loaded, when I included the file /wp-admin/admin.php to load wp framework, this redirected me to login page. When a user logs in using […]