• Resolved bento

    (@bento)


    I urgently need a solution to fix the page title on a profile.

    Login/Register page title should be = Login/Register
    Profile page title should be = Profile

    Currently the Profile page title is “Logout” when I use the default WP title tag:

    <?php the_title('<h2>', '</h2>'); ?>

    How can I change this?

    I tried to find out about custom templates for TML i.e. for register/login and profile pages, but there is no documentation whatsoever:
    https://www.jfarthing.com/docs/Theme_My_Login/Templates

    I know how to change a page title on a custom page i.e.

    <?php if (is_page('login')) { ?>
    <h2 class="page">Register/Login</h2>
    <?php } ?>

    But since the login page and the profile page are in fact the same page (only the “Page Action”? is different), I don`t know how to apply this technique.

    Basically I would like to change the page title on a “Login Page Action” i.e.

    …profile/?action=profile

    or

    …profile/?action=login (if there is such a thing)

    Something like this did not work:

    <?php if (is_page('profile/?action=login')) { ?>
    <h2 class="page">Register/Login</h2>
    <?php } ?>

    Many thanks for your help!

Viewing 13 replies - 1 through 13 (of 13 total)
  • I’m looking for pretty much the same thing.
    I want the title of this page: www/mydomain.com/login?action=register
    to be “Application” instead of “Register”.
    I am using Register Plus Redux but it doesn’t seem to be able to control that field.

    Plugin Author Jeff Farthing

    (@jfarthing84)

    Be sure that your page.php template properly calls The Loop.

    Hi Jeff, I’m still trying to wrap my head around WordPress – I’ve worked with other CMS before and have some basic php knowledge.

    I installed Theme My Login for use in my right sidebar and it is functioning as I would expect for Login and Lost Password: https://www.vancouverfamilypractice.ca/about

    I installed Register Plus Redux to use for the Member Application form and created a hard link in the right side bar to ‘login?action=register’ which loads the Login page WordPress automatically installed in pages but with the Redux form:
    https://www.vancouverfamilypractice.ca/login?action=register
    Depending on the action (login, register or lostpassword), it loads 1 of 3 versions of the page.

    So I think I am trying to figure out how to get a bit more control on that page without editing the WordPress core files. I read something about over-writing some of this via my theme’s function.php but didn’t understand enough to affect any changes in testing.

    Perhaps it is a matter of figuring out a conditional statement for the title based on it being one of the login pages ‘<?php the_title(); ?>’

    my page.php currently looks like:

    <?php get_header(); ?>
    
    <div id="container">
    <div id="content">		
    
    <?php the_post(); ?>
    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    
    <?php /* WordPress Breadcrumbs 1.2.3 installed in Widgets - customized 1102 for style  */ ?>
    <div class="breadcrumbs">
    <?php if(function_exists('breadcrumbs')) { breadcrumbs(); } else { bloginfo('name'); echo '(breadcrumbs are unavailable)'; } ?>
    </div><!-- end /.breadcrumbs -->
    
    <h1 class="entry-title"><?php the_title(); ?></h1>
    <div class="entry-content">
    <?php the_content(); ?>
    <?php wp_link_pages('before=<div class="page-link">' . __( 'Pages:', 'your-theme' ) . '&after=</div>') ?>
    <?php edit_post_link( __( 'Edit', 'your-theme' ), '<span class="edit-link">', '</span>' ) ?>
    </div><!-- .entry-content -->
    </div><!-- #post-<?php the_ID(); ?> -->			
    
    </div><!-- #content -->
    </div><!-- #container -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Plugin Author Jeff Farthing

    (@jfarthing84)

    mviens: Your question is completely different. You should have started your own thread.

    I’m not sure it is completely different – maybe I’m unclear in my request.

    I am trying to change the page title from “Register” to “Application”.
    Seeing this in the original request, it looks like the same thing:

    But since the login page and the profile page are in fact the same page (only the “Page Action”? is different), I don`t know how to apply this technique.

    Basically I would like to change the page title on a “Login Page Action” i.e.

    …profile/?action=profile

    or

    …profile/?action=login (if there is such a thing)

    Plugin Author Jeff Farthing

    (@jfarthing84)

    You will want to use the ‘tml_title’ filter. Create a file called theme-my-login-custom.php in your base /plugins directory and add the following:

    <?php
    function tml_title_filter( $title, $action ) {
    	if ( 'register' == $action )
    		return __( 'Application' );
    	return $title;
    }
    add_filter( 'tml_title', 'tml_title_filter' );
    ?>

    Jeff:
    Long time listener, first time caller… ??

    Following your thread.
    Got a handle on most every part of your plugin except for the topic bento and mviens brought up here.

    I write my own WP themes so I keep much of the code clean. I am calling the <?php the_title(); ?> call in the page template, I created the theme-my-login-custom.php in my base /plugins

    I used the code you cited above (added the 10,2 to the add_filter line as I was getting a Missing argument 2 error and I saw they existed in code you had submitted in another post: ttp://tinyurl.com/5vs4kyj (the version I am using is below).

    The title does not change.
    I tried using the show_title fasle via short code and via template tag and it didn’t take.

    I saw you had provided on your forum a method for removing the title filter so that I can add it back in to page templates: https://tinyurl.com/6kqlgf4
    But while I can do that and use template tags for separate templates, it would be cool if I could get the action based filter to snag.

    I left the returned title of Application since if that showed, I would know it was working and could then apply it to other actions, conceivably.

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

    I am running WP 3.1, TML 6.1.2, PHP5, and the theme is of my own development.
    The page in question is: https://tinyurl.com/649r9xl
    The page template code is: https://gist.github.com/871861

    Let me know what you think.

    Plugin Author Jeff Farthing

    (@jfarthing84)

    andradenation: Oops. You are correct that the filter should be hooked with 2 arguments:

    add_filter( 'tml_title', 'tml_title_filter', 10, 2 );

    Hi Jeff,
    Great work !!!
    May be the more flexible solution would be to add more options to your plug’in, in order to make it more customizable to match various use cases without having to add code snippets. And this should be very easy facing the nice code you provide…
    Best regards,
    Thierry

    Plugin Author Jeff Farthing

    (@jfarthing84)

    The reason there is no interface to enter your own page titles is because manually entered options would not be translatable.

    Hi Jeff, so I tried that code to change the Profile page title…

    function tml_title_filter( $title, $action ) {
    	if ( $action == 'profile' )
    		return __( 'My Account' );
    	return $title;
    }
    add_filter( 'tml_title', 'tml_title_filter', 10, 2 );

    Nothing happened. However if I choose action ‘login’ it will modify the title of the login page. So I’m still stuck with how to change the Profile Page title?

    Plugin Author Jeff Farthing

    (@jfarthing84)

    Try changing the priority from 10 to 11.

    add_filter( 'tml_title', 'tml_title_filter', 11, 2 );

    Yes that works perfectly! Thank you so much!!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘[Plugin: Theme My Login] Change Page Title for Profile Page’ is closed to new replies.