Login Page Templates?

From what I recall, WP does not allow themes to change anything relating to the login page filters or hooks from within your theme construction. Historically this is “plugin territory.” Sooo, My question is: Do you think it might be appropriate to allow theme authors to create a template for login and logout pages, mostly so that the pages MATCH the theme structure and styling formats?

I know petitions are going the wayside, so maybe this could become a reasonable topic… How would templating work if login.php is in the WP root? And Customizing the Login Form « WordPress Codex covers much of the ‘basics’ but, is there a method to divert login.php to a theme template login-theme.php maybe? And without security issues.

Or is it the security stability of login.php that requires it to be in the root directory? (cookies, etc.)

I don’t know if there is a security concern. I will let others chime in on that.

I want to add that ClassicPress goes a little bit further than WP by providing users with an option to change the login page logo.

Yes, the option for self logos on the login is one of the best “tiny” things CP does. Not sure why WP never did this; it seemed like a no-brainer to me. Or at least a UI that almost everyone WANTS to have options for that WP should have recognized a long time ago.

My guess it that theme authors could add customizer options for login page but my biggest concern was the ability to create a Template for the login page, just like an author would create a template for single page or archive specific page.

I have not really seen much on the topic as to whether or not a template could/would be seen by the wp templating engine if, it were place in the theme directory. wp-content/themes/themeslug/login.php ?

It was done for branding purposes back in the day. Even adding a logo was unheard of and you would use a header image.
That way people were bombarded with WP logos everywhere and it was “advertising”.

Now they don’t need it anymore but low and behold themes do still include the proudly powered, there’s no way to have custom login page inbuilt in core like CP does and on the .com lower plans you are not allowed to remove WP footer credits.

It’s paid software that they graciously allow us to use free on self-installs and that move was made to have free advertising. Like shops giving you their fabric shopper bags with their logo for free

To understand this, think of your site as two sets of pages:

  1. the dynamically generated pages from the posts database table
  2. the admin pages for using the software

The theme is invoked only for the “posts” from the database and not for the admin pages (like login.php). While we are at it, note that all the generated pages that make up the site revolve around the posts database table (not user table or comment table or options table). So anything outside of showing the posts is plugin territory.

Thanks for the responses, all. I do fully understand the advertising that WP instilled by doing this and also understand that they have outgrown the need for such. That said, it is too bad the separation of “dynamically generated pages” and core/admin related functionality of the login page—as joyously mentions— causes such a stern division between database generated pages and the ability to harness login access. Maybe an Ajax-based extension that required some heavy salt and hashes to assist in handshaking to and from admin/front end would allow template integration for login page.

But of course that would be plugin territory… Sound like what Viktor mentioned (logo upload to login page) is about as far as we could go with any core changes to this subject. Maybe add an h1 tag with site name and a better back-to-site button! to that same Settings > General options?

There are several plugins that do this. WPBeginner list a few and even gives code to add to theme’s function file.

Unless I have misunderstood the question

There was a discussion about that. I even did some mockup work. We may revisit this once v2.0 launches.

This is ultimately where this thread convo’ ended up at… “Plugin Territory” but the original question was: …is it possible to allow theme authors a login template to add to the theme…

Good read. Maybe if this ever gets put back on the burner; an admin only Widget could be utilized that not only helps “brand” login page, but the dashboard widgets as well. ??

Then [maybe] a theme author could hook into ‘that’ widget to customize the “theme login page”!

It is possible to hook into the login page as a theme author. this works well:


/**
 * add heading to login page
 * @since 1.0.0
 * @return HTML
 */
add_action('login_header', 'fpwatcher_login_header_heading');
function fpwatcher_login_header_heading(){

	echo '<div style="text-align: center;margin-top: 1em;margin-bottom: -2em;height:33px;background:#f3f5f7;border-bottom:1px dotted #aaa">
	<h1>' . esc_html__('Name of Website Login Page', 'twenty-sixteen') .'</h1>
	</div>';

}

‘login_enqueue_scripts’ should of used instead of inline styles
there are also hooks for footer, title, and even login_form_middle positions.

You can add code to the theme to do all kinds of things, but it is better handled as a plugin so that you can still easily change themes without affecting those things that are outside the scope of theme responsibilities (which is presenting the front-end pages).
Your original question was whether there was a template for it, and the answer is that there is not because it’s back-end, not front-end.

I use this:

The “answer” I was looking for (and maybe should have been more transparent) would have promoted a no answer of course since there is NOT such a template… this I am aware of. What I would like to see is if there is any way to actually create a template for login so that themes CAN have their own page styled that comes with the theme.

As @canban13 mentioned, there ARE filters for this but the implementation that I feel is ideal would be to have a template that MATCHES the theme and to include header, footer, menus etc.

As I fully realize the login is a “backend” ‘thing’ I would have to suffice with the fact that most theme builders do not have the skill set to make a secure login page work. As does Woocommerce or other plugins which allow custom account pages with a login. That is sort of what I was reaching at.