WordPress.org

Ready to get started?Download WordPress

Forums

Theme My Login
[resolved] Change Page Title for Profile Page (14 posts)

  1. bento
    Member
    Posted 3 years ago #

    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:
    http://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!

  2. mviens
    Member
    Posted 3 years ago #

    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.

  3. Jeff Farthing
    Member
    Plugin Author

    Posted 3 years ago #

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

  4. mviens
    Member
    Posted 3 years ago #

    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: http://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:
    http://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(); ?>
  5. Jeff Farthing
    Member
    Plugin Author

    Posted 3 years ago #

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

  6. mviens
    Member
    Posted 3 years ago #

    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)

  7. Jeff Farthing
    Member
    Plugin Author

    Posted 3 years ago #

    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' );
    ?>
  8. andradenation
    Member
    Posted 3 years ago #

    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: http://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: http://tinyurl.com/649r9xl
    The page template code is: https://gist.github.com/871861

    Let me know what you think.

  9. Jeff Farthing
    Member
    Plugin Author

    Posted 3 years ago #

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

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

  10. i-creativ
    Member
    Posted 2 years ago #

    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

  11. Jeff Farthing
    Member
    Plugin Author

    Posted 2 years ago #

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

  12. ellebillias
    Member
    Posted 2 years ago #

    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?

  13. Jeff Farthing
    Member
    Plugin Author

    Posted 2 years ago #

    Try changing the priority from 10 to 11.

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

  14. ellebillias
    Member
    Posted 2 years ago #

    Yes that works perfectly! Thank you so much!!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic