• In the sidebar widgets, there is a “Meta” widget that shows different options, including a link to the admin page for logged in users. Problem is, we don’t want the rest of those meta items showing up in the sidebar, so it would be much better if we had our links in the footer.

    I have already added the RSS feed and Login/Login links to the footer. Which PHP snippet would I use for this?

    This is what I use for the login/logout link:

    <?php wp_loginout(); ?>

    IOW, need the same for the admin link, and if there are any conditionals that would allow me to use a pipe symbol or bullet between this and the other items at the bottom.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter Rudy64

    (@rudy64)

    Nothing exists…?

    when you’re logged in doesn’t the admin link replace the login link?

    Why not just edit the code from within widget.php to what you want in there?

    Thread Starter Rudy64

    (@rudy64)

    Thanks for the replies!

    >> when you’re logged in doesn’t the admin link replace the login link?

    No, it’s replaced with a logout link. We *can* log out and then log back in, which takes us back to the admin pages, but that’s a double step I’m looking to avoid.

    >> Why not just edit the code from within widget.php to what you want in there?

    I thought about that, but it appears that it’s a whole module rather than just one specific link…and there may be dependencies on other functions in the widget file that I’m not seeing. I did try to find a specific “admin” block of code in there, but had no luck so far…that was actually the first thing I tried.

    I could just hard-code an “admin” link in there, but I’d prefer it to not be visible if a person is not logged in. Maybe I could somehow work this hard link into the conditional that makes the “Login” button change to “Logout”…? That might be my next move.

    You need to put this:

    <?php wp_register('',''); ?>
    <?php wp_loginout(); ?>

    The “admin” link replaces the “register” link. On my blog, I’m the only writer and nobody is allowed to register, so “register” never shows up. “admin” shows up when I’m logged in.

    Thread Starter Rudy64

    (@rudy64)

    Found it!!

    I went looking for the wp_loginout() function to find out if I could add in a line of code to print the admin link next to the logout link. But, I did not want to alter the code: I wanted a template fix.

    Just below wp_loginout() is another function wp_register(), which toggles a “register” link if a person is logged out AND registration is enabled; if a person is logged in, this link toggles over to the “Admin” link I was looking for.

    So in my footer template, all I needed to add was:

    <?php wp_register('','') ?>

    Since registrations are disabled, this shows the Admin page link whenever I’m logged in. Works perfect!

    Thread Starter Rudy64

    (@rudy64)

    jabecker: we posted almost simultaneously. 😀 Great minds… 😉

    Thanks!

    well… glad to be of help. Even though I wasn’t. 🙂

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

The topic ‘Need “Admin” link for footer’ is closed to new replies.