• Welcome to Tux Reports: Where Penguins Fly. We hope you find the topics varied, interesting, and worthy of your time. Please become a member and join in the discussions.
Resource icon

HowTo: Add XF Login Form to WP Header

This resource describes how to add a XenForo login to a WordPress child theme. The resource is not showing the actual form code. The code will be added in the next version.

Step 1: Open /wp-contents/theme/child-theme/header.php with your favorite text editor.

Step 2: If a fieldset does not exist then create one.

Step 3: Add the form tag and php code

PHP:
<div id="xenlogin">
    <form action="http://community.tuxreportsnetwork.com/login/login" method="post" id="pageLogin">
    
        <div class="ctrlWrapper">
            <dl class="ctrlUnit">
                <label for="LoginControl">Your name or email address:</label>
                <input type="text" name="login" id="LoginControl" class="textCtrl" tabindex="101" />
    
                <label for="ctrl_password">Password:</label></dt>
                <input type="password" name="password" id="ctrl_password" class="textCtrl" tabindex="102" />
    
                <input type="submit" class="button primary" value="log_in" tabindex="104" data-loginPhrase="log_in" data-signupPhrase="sign_up" />
                <label for="ctrl_remember" class="rememberPassword">
                <input type="checkbox" name="remember" value="1" id="ctrl_remember" tabindex="103" /> stay_logged_in</label>
        </div>
    
        <input type="hidden" name="cookie_check" value="1" />
        <input type="hidden" name="redirect" value=" ' . get_permalink( $post->ID ) . ' " />
        <input type="hidden" name="_xfToken" value=" ' . $XF->visitor->get( 'visitor.csrf_token_page' ) . ' " />

    </form>
</div>

Step 4: Modify the location of the XenForo login.

Step 5: Save header.php and upload to your server.

Step 6: Test the login form.

Step 7: Modify the form CSS

Redirection may fail if cookies are not set in /library/config.php.

Use the other resources on this site to add username, login information, links, alerts, etc.
Author
LPH
Views
306
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from LPH

Latest updates

  1. Add Code For Login Form

    Add code for the login form.
Top