• I’m interested in trying to change the sidebar widget’s “Welcome” message to something of my choosing.

    In a previous thread where I asked this question the plugin author gave instructions and a code. And it worked. However it also did this weird thing where it replaced the text for the “Logout” link in Theme My Login widget with the new “Welcome” message.

    Listed below is the author’s code (that I was able to tweak a little bit so it would include the user’s name in the greeting, like it does in the original widget). However, I still can’t figure out how to stop it from changing the text of the “Logout” link to the new “Welcome” message.

    Does anyone know how to change the text back to “Logout”? Or have a better way to change the “Welcome” greeting?

    <?php 
    
    function tml_title( $title, $action ) {
    	if ( is_user_logged_in() )
    			$title = sprintf( __( 'Welcome,<br/>%s', 'theme-my-login' ), wp_get_current_user()->display_name );
    		return $title;
    }
    add_filter( 'tml_title', 'tml_title', 10, 2 );

    https://wordpress.org/plugins/theme-my-login/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter sassyfrass475

    (@sassyfrass475)

    This is the original way I found that changes the sidebar widget’s “Welcome” to whatever you want. However, it involves modifying the plugin’s core files.

    This isn’t the preferred option because, as the plugin’s author noted in this thread, when you update the plugin, you lose the changes.

    DIRECTIONS

    1.) In your WordPress install go to the folder: wordpress/wp-content/plugins/theme-my-login/includes/
    2.) Open the file: class-theme-my-login-template.php
    3.) Locate the word “Welcome” and replace it with whatever greeting you’d like. For example, replace “Welcome” with “Hello”.
    4.) Save the edited class-theme-my-login-template.php document to wordpress/wp-content/plugins/theme-my-login/includes/
    6.) Refresh the page. Now, instead of “Welcome” it should have “Hello” or whatever you put as your personal greeting.

    I know this is old, but I was looking for a solution to exactly the same issue and came up with this, which changes the title but not the logout text.

    function my_tml_title( $title, $action ) {
    	if ( is_user_logged_in() ) {
    		if (strpos($title,'Welcome') !== false) {
    			$title = sprintf( __( 'Hello %s', 'theme-my-login' ), wp_get_current_user()->display_name );
    		}
    	}
    		return $title;
    }
    add_filter( 'tml_title', 'my_tml_title', 10,2);

    All I’ve done is check for the work ‘Welcome’ in the title and only change it if it contains the word ‘Welcome’.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change the Sidebar's Widget "Welcome" Greeting’ is closed to new replies.