Home > CMS > Small hack for a quick Admin link in WordPress

Small hack for a quick Admin link in WordPress

I’ve been playing with WordPress a lot lately and I’m really starting to feel the Love ! I’m still customizing our this blog and needed to have a quick Admin link easily accessible to go in the admin panel of WordPress. Yes, I can always scroll down the right column and click on Site Admin link in the Meta block. But, I have to scroll, and I hate that ;-) . So I decided to hack in in. And I thought I’d share this. Oh and I’m sure thousand of people have done this already, but hey, the more the merrier, right ?

So I went in Admin > Appearance > Editor to edit the header.php file of the theme I’m using. I located the place where I wanted to insert the link and used the is_user_logged_in function to test if we wanted to display the admin link or not. Then, I used the admin_url function (which is not documented in WordPress codex ?) to get the URL we needed to access the admin side. So, all in all, it looks like this:

<?php if (is_user_logged_in()) {?> | <a href=”<?=admin_url();?>”>Admin</a><? } ?>

Here is a screenshot of what it looks like when loged in:

adminLink

Categories: CMS Tags: wordpress
  1. No comments yet.
  1. No trackbacks yet.