Theme switcher only for Admin? (4 posts)

  1. Kerim
    Posted 11 years ago #

    I'm trying to wrap the Theme switcher plugin so that only the admin can see it. That way I can work on a backup theme while my site's regular viewers see the regular theme I have set as default. However, I don't seem to have the PHP code right. Can anyone help?

    Here is what I have:

    <?php global $user_level; if ($user_level > 8) { ?>
    <h2>Theme Switcher</h2>
    <?php get_theme_switcher() ?>
    <?php } ?>

    If I remove the PHP code the theme switcher shows up just fine. With the PHP code I never see anything. I even tried adding an "echo $user_level;" command, but that didn't do anything either. What am I missing?

  2. Joshua Sigar
    Posted 11 years ago #

  3. Kafkaesqui

    Posted 11 years ago #

    Try this:

    <?php get_currentuserinfo(); if ($user_level > 8) { ?>

  4. Kerim
    Posted 11 years ago #

    alphaoide: I had tried that and it disabled my entire WP install!!! Also, it doesn't offer such a nice menu, or persistent caching across sessions.

    Kafkaesqui: Thanks! You put me on the right track. This works:

    <?php get_currentuserinfo(); global $user_level; if ($user_level > 8) { ?>

    Just what I wanted!

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.