WordPress on the Custom landing page and disable the own landing page

Source: Internet
Author: User

After using WordPress to create a theme, do not want his own landing page and address.

1. Create a new user page to take over the action related to the login
Create a new page-login.php in the theme root directory, get the user action by action, and then do different processing. Of course, you can just put the login action code inside, the rest of the new page-register.php and other pages. $action = Isset ($_request[' action ')?            $_request[' action ': ' Login '; global $wpdb, $user _id;switch ($action) {case ' logout ': if ($user _id) {            Wp_logout ();            $redirect _to = apply_filters (' Logout_redirect ', $redirect _to, $requested _redirect_to, $user);        Wp_safe_redirect ($redirect _to);    } exit ();        Case ' Forget ': if ($user _id) {wp_redirect (get_bloginfo (' url '));    } else {//write the process of forgetting the password here} exit (); Case ' reset ': if ($user _id) {//Here write the process of resetting the password} else {Wp_redirect (Wselibrary_getloginu        RL ());    } exit ();        Case ' register ': if ($user _id) {wp_redirect (get_bloginfo (' url '));    } else {//write the process of user registration here} exit (); Case ' login ': default:if ($user _id) {Wp_redirect (Get_bloginfo (' URL ')); } else {//Here Write user login process} exit ();}
2, disable the landing page of WordPress comes with
The principle is very simple, that is, to allow users to access the landing page with a direct jump to the specified page if (!function_exists (' login_protection ')) {    function login_protection ()    {        //If necessary, you can give yourself a way to access        if ($_get[' superuser ']! = ' password ') header (' Location:/index.php/login ');        Of course you can also prohibit everyone from visiting        //header (' Location:/index.php/login ');    }    Add_action (' login_enqueue_scripts ', ' login_protection ');}

  

WordPress on the Custom landing page and disable the own landing page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.