Adding a sidebar to wp-login.php

so I'm running a membership site and want the login page to promote the value of signing up. I can't figure out how to get a sidebar to display on this page. Everything I've tried breaks wp-login.php. Any ideas?


Here is my hack to add content above the login form using the login_body_class filter...

function login_body_hack($classes) {
    $classes[] = 'PLACEHOLDER';
    add_filter('attribute_escape', 'login_body_filter_hack',999,2);
    return $classes;

function login_body_filter_hack($safe_text, $text) {

    // add whatever you like content here
    $newcontent = '<div id="contentwrapper'>CONTENT</div>';

    $replace = '">'; // closes the body tag early
    $replace .= $newcontent;
    // some tag to be closed, as suffixed with the original ">
    $replace .= '<img src="javascript:void(0);" style="display:none;';
    $safe_text = str_replace('PLACEHOLDER',$replace,$safe_text);
    remove_filter('attribute_escape', 'login_body_filter_hack',999,2);
    return $safe_text;

Note however that "as is" this will the content to all "login" pages (register, reset, lost password etc.) not just the login form one, so further checks would be needed to handle those cases.

Category: php Time: 2016-07-28 Views: 0
Tags: php login sidebar

Related post

  • Blocking access to wp-admin and wp-login.php using Apache virtual hosts and different ports 2011-04-21

    I have a site running WordPress defined in a virtual host listening at port 80 ( I want to stop people accessing /wp-admin and wp-login.php but to allow access when they look in a different port like or

  • Restrict Access to wp-login.php 2011-08-11

    I have a hard coded login/register/lost password form in the sidebar of my theme. I am using hidden input for "redirect_to" which is working fine. But when I press login button without entering anything or specifically when an error occurs, it r

  • How to modify the action attribute of the wp-login.php?action=register form? 2011-08-19

    I'm trying to create a reference registration system in Wordpress. The idea is that the user will click a link which will contain wp-login.php?action=register&ref=12345 I'm hooking into the 'register_form' action hook and adding a reference number hi

  • Rewrite rule that wp-login.php?action=register is left alone 2011-10-17

    Unfortunately buddypress breaks a facebook connect script because of the rewrite rules. It changes /wp-login.php?action=register into /register/ I tried to find where the custom rewrite rule is located but wasn't successful. Is there any way to just

  • Adding extra authentication field in login page 2012-03-17

    I am going to enhance my WordPress authentication page. My idea is that simply adding an extra field into the login page. The extra field will require user to enter personal identification code (4 to 8 digit). I have changed the login page layout in

  • I cannot log into my wordpress site with my wp-login.php 2012-07-11

    I can login into - but I cannot login to to my hosting wordpress site: When I try to reset password it only recognises my wordpress username - but not my existing emails that are linked with my

  • How can I remove "Powered by Wordpress" pop-up disclaimer in wp-login.php? 2012-08-13

    In wp-login.php I added my corporate logo. However, when the mouse hovers on it, the disclaimer "Powered by Wordpress" appears. How can I remove it? --------------Solutions------------- Did you check out the codex?

  • replace wp-login.php login forms via a hook & use custom forms with wp-login form validation 2013-01-07

    I am customizing all the wp-login.php forms, i.e., login, lost password, register, etc. I have a working model but when I decoded to toss in the default error messages on my custom forms I thought there must be a better way to make custom forms and s

  • send users logging in from wp-login.php directly to home page of site, rather than dashboard 2013-01-17

    I am currently using a plugin called Sidebar Login which allows users to bypass the dashboard and go directly to the site. However, when users login via /wp-login.php (e.g. when they click on their verification links in their emails), they are once a

  • Change 'Back To Website' link in wp-login.php 2013-01-18

    The login form on the page wp-login.php has a link at the bottom that says "Back to website-name" This link always redirects to the home page I would like it to redirect to the page the user has come from. I imagine this requires a hook added to

  • Wordpress Multisite local: wp-login.php refreshes on login Chrome Browser 2013-03-18

    I just set up Wordpress Multisite on my local machine following this tutorial. When I try to login to the admin using Google Chrome, the page just refreshes. I've tried Firefox, and I'm able to login and use Wordpress Multisite normally and access th

  • How to rename the WordPress wp-login.php running on IIS6? 2013-07-13

    My Windows 2003 VPS recently hang due to bots hammering my WordPress login php non-stop for hours (determined from IIS6 logs). This caused MySQL to use up all the allocated 1G RAM. After resetting my VM, I quickly renamed wp-login.php to prevent my s

  • wp-login.php not returning error messages / or gives 404 2013-10-18

    I have several WP sites that were logging in fine last week. Now today thay are all failing to login using the native wp-login.php. The strange thing is some of the sites have the "Woocommerce" plugin installed, using the plugin login form I can

  • How to change "Registration complete. Please check your e-mail." in wp-login.php 2013-10-25

    I want to override the phrase "Registration complete. Please check your e-mail." without modifying the core code in wp-login.php Does anyone know what the add_filter() or add_action() might look like? Thanks. --------------Solutions-------------

  • fail2ban to block Wordpress brute force attacks on wp-login.php 2014-07-22

    Is there a way to set up fail to ban to block on IP that hits wp-login too many times? I have tried adding this jail.local: [apache-wp-login] enabled = true action = iptables[name=wplogin, port=http, protocol=tcp] sendmail-whois[name=wplogin, dest=ro

  • White screen of death for wp-admin and error for wp-login.php after entering credentials 2014-10-27

    I am getting the white screen for wp-admin and "ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress" when i try to login through wp-login.php Earlier i was getting the same error but i looked for

  • Add HTTP authentication to wp-login.php and wp-admin vps wide 2014-12-04

    In order to protect customer's WordPress installs and the vps itself, i would like to know how i can add "HTTP authentication" to wp-login.php and wp-admin folder vps wide, for each WordPress install. I know it is possible without having to edit

  • Adding Social Network Features to a PHP App with Neo4j 2015-02-16

    Graph Databases in PHP with Neo4j Discover Graph Databases with Neo4j and PHP Adding Social Network Features to a PHP App with Neo4j In the last part, we learned about Neo4j and how to use it with PHP. In this post, we'll be using that knowledge to b

  • Adding Multiple Sidebars 2015-02-19

    Hello all I would like to add multiple sidebars to my wordpress site I currently have 2 sidebars registered in functions.php like so: function themename_widgets_init() { register_sidebar( array( 'name' => __( 'Sidebar', 'themename' ), 'id' => 'sideb

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 1.243 (s). 13 q(s)