• I am trying to change the title that is displayed to the user on several of the login pages. I have read the forum post here regarding how to achieve this and am having no success. I have also read through the codex section on filters and cannot find a solution.

    I have the following code saved in theme-my-login-custom.php in my template directory:

    <?php
    function tml_title_filter( $title, $action ) {
    	if ( $action == 'profile' )
    		return __( 'Your Account' );
    	return $title;
    }
    add_filter( 'tml_title', 'tml_title_filter', 10, 2 );
    ?>

    I am using wp_title('') in 2 places outside of The Loop and the_title() inside one of the loops (I have multiple loops to ensure the breadcrumbs plugin I am using works correctly).

    Have I missed a step out somewhere? So I need to enable filters somewhere in my custom theme or in the plugin that I am not aware of?

    Are there any known conflictions between theme-my-login and other plugins such as membership?

    I appreciate any help on this issue.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The proper path is /wp-content/plugins/theme-my-login-custom.php.

    I must admit.. I am absolutely baffled by ‘the loop’. I can’t make any sense of it.

    Can I not simply edit a file to change the title Log Off to Profile?

    @flynny: This is done automatically when the theme is coded properly.

    Actually, I found out why it’s not working for me. I have some conditionals in regards to my header, and changing the title for “theme_my_login” ONLY works if you’re using <?php the_title(); ?>

    In my case, my code was using echo get_the_title(); instead of the_title(); and “Theme My Login” ignores the get_the_title() function.

    so if it’s not working for you, be sure you’re NOT using get_the_title() as I was. (and for the record, that’s not something that shows my theme isn’t “coded properly.” Just the plugin doesn’t use/acknowledge the get_ thing.)

    Just thought I’d pop this note in here, because I finally got it to work after getting rid of the get_ part of things.

    ETA: it also has to be *after* the while(have_posts()) part of the loop. So now I have to do some configuring so my conditionals for the page title don’t get all messed up, since mine is after if(have_posts()), so the title only gets shown once. (Not the login title, of course, but if I move the whole conditional *after* the while part, then the title will show up in my blog for every post – and I don’t want that! ?? )

    Actually, that is incorrect. The function the_title() is simply just a wrapper function for get_the_title(). The filter the_title is applied to get_the_title(), effectively applying it to both functions.

    The TML title filter uses in_the_loop() to determine whether it is for the navigation menu or for the page title. The function in_the_loop() is set to true after the_post() is called.

    Then something must be wrong, because I was (properly) using “get_the_title()”, and I was within the Loop (but only the “if(have_posts())” part), and the filter refused to work until I switched it to “the_title()” and moved it after the “while(have_posts()): the_post();”

    I do know the_title is just a wrapper for get_the_title, but my “get_the_title” certainly didn’t work (even after being placed after “the_post();”) – I *had* to switch it to “the_title();” before it would work. Believe me, I tried not to edit my code *too* much to mess up what I was doing with other pages! ??

    @flynny, he is correct in saying it is done automatically, but you sound like you may be somewhat new to programming. $title is a variable, it is not constant, you can only change it in that code once you have some condition stop on a piece of information you want to change in a situation you determine in a conditional structure. That is why it is called ‘the loop’, each time it loops, it fetches another post, and the information stored in $title or any of the other variable are potentially and most likely different. In each situation that $title value will be whatever it was set to in the WordPress’s GUI back end. So I think what you might have wanted to know is that you don’t have to change it there, you do it in the CMS.

    I could well have misinterpreted you since there’s not a whole lot of information to go by. I hope it was helpful just the same.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: Theme My Login] Unable to change Page Title with tml_title filter.’ is closed to new replies.