WordPress.org

Support

Support » Themes and Templates » Changing Register, Login, Logout and Site Admin Links

Changing Register, Login, Logout and Site Admin Links

  • itsonlybarney

    @itsonlybarney

    How can I go about changing the links for register, login, logout and site admin to images? Which files do I need to change to change the text of the links to images?

Viewing 6 replies - 1 through 6 (of 6 total)
  • you need to edit the file template-functions-general.php, you can find it under your wp-includes folder

    there, look for:


    function wp_loginout() {
    if ( ! is_user_logged_in() )
    $link = '<a href="' . get_settings('siteurl') . '/wp-login.php">' . __('Login') . '</a>';
    else
    $link = '<a href="' . get_settings('siteurl') . '/wp-login.php?action=logout">' . __('Logout') . '</a>';
    echo apply_filters('loginout', $link);
    }
    function wp_register( $before = '<li>', $after = '</li>' ) {
    if ( ! is_user_logged_in() ) {
    if ( get_settings('users_can_register') )
    $link = $before . '<a href="' . get_settings('siteurl') . '/wp-register.php">' . __('Register') . '</a>' . $after;
    else
    $link = '';
    } else {
    $link = $before . '<a href="' . get_settings('siteurl') . '/wp-admin/">' . __('Site Admin') . '</a>' . $after;
    }
    echo apply_filters('register', $link);
    }

    then, replace:

    __(‘Register’)
    __(‘Login’)
    __(‘Logout’)

    and

    __(‘Site Admin’)

    with:

    <img src="images/your_image.gif" width="" height="" border="0">

    don’t forget to replace: images/your_image.gif with the actual path to your image. This path should be different in each case.

    hope it helps

    Just because it is open source, it does not mean you can edit the core WP files, just for doing small stuff.

    Now whenever there is a new version of wordpress, you need to update the files again.

    if you just want to display an image for these links, you can change it in your theme’s sidebar.php file. Thats the best and right way to do this.

    Thanks
    Sadish

    Just because it is open source, it does not mean you can edit the core WP files

    Actually, you can. There is nothing in the license that would forbid it.
    But… it is not the smartest thing, I agree 🙂

    “then, replace:

    __(‘Register’)
    __(‘Login’)
    __(‘Logout’)

    and

    __(‘Site Admin’)

    with:

    <img src=”images/your_image.gif” width=”” height=”” border=”0″> “

    i’ve been fiddling with this for about an hour now, to no avail. no matter what i change the text values to (because at first all i wanted to do was change what Login and Register said) the output of wp_loginout still says Login, even if the (‘ ‘) says something completely different. any ideas what is up?

    Sadish gave simple and easy advice.

    easy advice runs cheap these days, the truth is people have no choice but to hack WP in order to get it to do what they want it do to. Many times, it’s simple things that should be part of the core but aren’t, so people have to hack the files, i say go for it. I hack the hell out of WP that doesn’t mean i don’t think its a good software it is but it’s just not functional on some levels so i have no problem taking an ax to it.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Changing Register, Login, Logout and Site Admin Links’ is closed to new replies.