WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Adding login and register links to the header (5 posts)

  1. crashley1784
    Member
    Posted 5 years ago #

    Hi all -
    So I've scoured the forums and docs, as well as google, and cannot find the answer to this question. I want to move the Login and Register links to the header of my website - to the left of my search box preferably. I do not want to have the Meta sidebar on my site, but still want users to be able to login and register. I tried copy / pasting the code from sidebar.php

    <li><h1>Meta</h1>
    			<ul>
    				<?php wp_register(); ?>
    				<li><?php wp_loginout(); ?></li>
    				<?php wp_meta(); ?>
    			</ul>
    		</li>

    It showed the links, but they didn't work. Then I tried including the

    <?php } ?>
    
    <li><h1>Meta</h1>
    <ul>
    				<?php wp_register(); ?>
    
    <li><?php wp_loginout(); ?></li>
    				<?php wp_meta(); ?>
    			</ul>
    </li>
    <?php endif; ?>

    but that triggered a fatal error in header.php.

    Any help with this issue would be greatly appreciated. The url to my site is http://s195944005.onlinehome.us/rcf/

    Thank you!

  2. esmi
    Forum Moderator
    Posted 5 years ago #

    Your first instinct was right. The two template tags you need are <?php wp_register(); ?> and <?php wp_loginout(); ?>. It's the placement within your header that's the problem. The header image is masking/hiding the links. Try adding:

    <ul class="headerlinks">
    <li><?php wp_register(); ?></li>
    <li><?php wp_loginout(); ?></li>
    </ul>

    immediately after <div id="header"> in header.php.

    Then add the following to style.css:

    #header .headerlinks {
    	position:relative;
    	top:20px;
    	left:600px;
    	z-index:500;
    }
    #header .headerlinks {
    	display:inline;
    	margin:0 5px 0 0;
    	padding:0;
    }

    The positioning is unlikely to be right first time and will need adjusting but should get you started.

  3. crashley1784
    Member
    Posted 5 years ago #

    Thank you thank you thank you!!!!! That worked! :D You rock.

  4. crashley1784
    Member
    Posted 5 years ago #

    LOL, not to sound picky, but any idea how I could get them into the spacer div located below the header? I'd really prefer the links to be to the left of the search box on my page, but that area is not a part of "header". As far as I can tell it's part of "content".

  5. esmi
    Forum Moderator
    Posted 5 years ago #

    Try playing with the top and left positioning in #header .headerlinks. You might be able to shift them to the position you want but I'm not sure how well that will work cross-browser.

Topic Closed

This topic has been closed to new replies.

About this Topic