• Nobody needs to log in expect me. How can I hide/style the Login link to be really indistinguishable? Or for that matter, remove it all together from the site?

    I have it in the sidebar under my site gategories like this:

    CATEGORY 1
    CATEGORY 2
    CATEGORY 3
    CATEGORY 4

    Login

    So how can I style it independent from the other content of the sidebar? I’ve tried everything I know, somehow the sidebar styling always over rules the stylings I’ve made ror the login button.

    Code from the Sidebar:

    <li><h2><?php _e(); ?></h2>
    				<ul>
    				<?php wp_list_categories('orderby=ID&show_count=0&title_li='); ?>
    				</ul>
    			</li>
    			<li><h2><?php _e(); ?></h2>
    				<ul>
    					<?php wp_register(); ?>
    					<li id="small"><?php wp_loginout(); ?></li>
    					<?php wp_meta(); ?>
    				</ul>
    			</li>

    Thank you

Viewing 8 replies - 1 through 8 (of 8 total)
  • Have you tried deleting the line:
    <li id="small"><?php wp_loginout(); ?></li>

    Thread Starter hilj

    (@hilj)

    Aa okay, I see, of course! I can now get to the Dashboard from https://www.mysite.com/wp-admin or something like that. And I can log out via Dashboard.
    I feel stupid.

    That should do it ??

    No need to feel stupid. I’ve been slowly stumbling through all of this and learning as I go. I’ve always felt that if I had a better knowledge of PHP then life would be easier and customising word press would be simple!

    It’s amazing what you can do though. If you use Presentation > Widgets you can quite easily select what will appear in your sidebar.

    Sometimes you get greater control using manually coded sidebars, but for most purposes the widget sidebars should suffice.

    I just added:

    #sem_admin_menu {
    	display:none;
    }

    I’ve been trying to remove the Log In link from my CSS sidebar. I tried removing the whole piece of the
    <li> fromp the sidebar.php file (as described above). I’m working in the Theme Editor. I saved the change… but it’s still there after I refresh the screen and look a my wordpress site. I’m not a PHP programmer, but I can tell you that the code in my theme’s sidebar looks exactly like hilj‘s. So, why is my Login still showing? any other ideas of how to remove it?

    dont edit your files through the admin theme editor. download the file via ftp, edit it in a text editor then upload it back.

    To remove the log in link, I went right to the source which is the function wp_loginout in /wp-includes/general-template.php. The code is simple enough:

    function wp_loginout() {
    	if ( ! is_user_logged_in() )
    		$link = '';//<a href="' . get_option('siteurl') . '/wp-login.php">' . __('Log in') . '</a>';
    	else
    		$link = '<a href="' . get_option('siteurl') . '/wp-login.php?action=logout">' . __('Log out') . '</a>';
    
    	echo apply_filters('loginout', $link);
    }

    I simply replaced the value of $link with ” in the if part of the conditional and commented out the original value. This way when I’m logged in I still get a convenient log out link that of course only an admin who has logged in will see. You just need to keep track of the change with a comment or something so you check for it when you upgrade which you would have to do with any change whether it’s in your theme folder or not. You may also want to remove the function call from the unordered list it’s in just to avoid an empty list item. Not that it causes a validation error, it’s just sloppy. This is just an alternative to alexleonard’s removal of the entire line which is much simpler.

    Since this post is along the same lines, I’ve just started to learn about a template’s function.php file, and I’m curious how to go about adding a filter (apply_filter(‘loginout’, …?) to remove the displayed login/logout text in the navigation area of my site, yet leave the text login/logout link valid in another section (the Meta widget). I’m using images in my navigation arear, and hence I don’t need the text. I’d edit the general-template.php file and remove the text links, but that would remove them from the Meta widget as well, and I’d like to incorporate it into my theme functions.php file so that it is not overwritten when I update WordPress.

    If you could suggest a good tutorial site regarding WordPress filters and their function, that would be great.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How can I hide/style the login link?’ is closed to new replies.