Forums

[resolved] How to add static text to login form / wp-login.php (7 posts)

  1. tationline
    Member
    Posted 5 months ago #

    Hello,

    how can I add static text to the loginform?
    I want to show a small welcome text below the image logo-login.gif, but all I tried didn't work (I am a Wordpress newbie ...).

    I couldn't find any information so far (the only way I found was to edit the graphic file ...).

    Thanks in advance for help :-)

  2. MichaelH
    moderator
    Posted 5 months ago #

  3. tationline
    Member
    Posted 5 months ago #

    Hi Michael,

    thanks for your response. I already did Google and WP-Plugin-searches, but all results I found will modify/replace the graphics file only and/or changing the text-layout via CSS.
    All I want to do is to add one line of text (something like "Welcome to my blog, you need to be registered to see content") above or below the login box.

    I was hoping, that this would only be one line of code, that needs to be added "somewhere" to wp-login.php. Or is this something that would need far more code changes?

    I do not want to create a new graphic file, because this would take much more time ... if it should look nice.

  4. MichaelH
    moderator
    Posted 5 months ago #

    Hate making changes to core code, but in wp-login.php you could change:

    if ( !empty( $message ) ) echo apply_filters('login_message', $message) . "\n";

    to

    $message = "Welcome to my blog, you need to be registered to see content";
    if ( !empty( $message ) ) echo apply_filters('login_message', $message) . "\n";
  5. MichaelH
    moderator
    Posted 5 months ago #

    Note: in 2.8 (once it is released) looks like the login_message is made more pluggable so you could add this to your theme's function.php file so you don't need to modify core code:

    function custom_login_message() {
    $message = "Welcome to my blog, you need to be registered to see content";
    return $message;
    }
    add_filter('login_message', 'custom_login_message');
  6. tationline
    Member
    Posted 5 months ago #

    Hi Michael,

    thanks again for your quick response!
    This is exactly what I was looking for!!!

    I don't like to modify core files either, but in this case it is just one line (which I can easily remember) and is definitely faster to implement than creating graphic files.

    Thanks again for your help.

  7. dimadin
    Member
    Posted 4 months ago #

    This message would be shown on both login and registration sceen, but how to show it only on login screen? I didn't find some conditional tags for it.

Reply

You must log in to post.

About this Topic