WordPress.org

Support

wp_register

  • I’m having some issues with a blog I’m currently styling.

    I moved the wp_loginout and wp_register statements into the footer, where each little bit of text is separated by a vertical slash, so it looks like

    Copyright etc. | Login | Designed by etc.

    The problem arises when I am logged in. The footer changes to

    Copyright etc. | Site Admin Logout | Designed by etc.

    which is very close to what I want; the only issue is the missing vertical slash between Site Admin and Logout.

    I’ve searched through my WordPress files quite a lot and cannot find where the phrase “Site Admin” is being generated or where to add that vertical slash afterwards. I tried adding it to footer.html, but then if I am logged out it shows two vertical slashes, obviously, which is not what I want at all.

    Anyone have an idea?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Anyone?

    Short of editing core files, this isn’t possible. How about hardcoding the <a href="wp-admin/">Site Admin</a> into your footer?

    Copyright etc. | Site Admin | Login | Designed by etc.

    Does it look that bad?

    But I want to edit core files. I want it to be contextual.

    Eric Amundson

    @sewmyheadon

    Volunteer Moderator

    Towers,

    There are a few easy ways to do this, depending on your theme. And, there’s absolutely no need to edit core files.

    One way would be to edit the wp_register template tag to include the pipe (|) character. Maybe something like this:

    <?php wp_register('<li>', '| </li>'); ?>

    This code example assumes you’re using an unordered list for your footer. If you’re not, you could insert the appropriate before & after tags.

    Another way might be to assign a class to the list item (or other) tag and use CSS to give it a border. Maybe something like this:

    <?php wp_register('<li class="reg_link">', '</li>'); ?>

    Then in your CSS, you could do something like:

    #credits li {display:inline;padding:0 1em;border-left:1px solid #ccc;}
    #credits li.reg_link {border:none;}

    This assumes that you have an unordered list with an ID of “credits” or, if you prefer, an unordered list wrapped in a containing div with an ID of “credits”.

    Of the two methods, the latter is, in my opinion, better because you have much more control of the outcome.

    Eric Amundson

    @sewmyheadon

    Volunteer Moderator

    Here’s another way too, which I’ve used myself:

    <ul id="credits">
        <li>&copy; <?php bloginfo('name'); ?></li>
        <?php wp_register(); ?>
        <li><?php wp_loginout(); ?></li>
        <li class="last"><a href="http://www.mywordpresssite.com">website by MyCompany</a></li>
    </ul>

    and in the CSS:

    #credits li {display:inline;padding:0 1em;border-right:1px solid #ccc;}
    #credits li.last {border:none;}

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘wp_register’ is closed to new replies.
Skip to toolbar