WordPress.org

Ready to get started?Download WordPress

Forums

Admin Question (4 posts)

  1. cartpauj
    Member
    Posted 7 years ago #

    In my side bar the Meta items are shown (Login/Logout - Register - WordPress - XFN - Valid XHTML - Valid CSS) I was just wondering what code I would enter to hide all those items Except Register and Login/Out unless I'm logged in as administrator. I'm currently using:

    <?php if(is_home()) {?>
      <?php get_links_list(); ?>
      <li>
    		<h2>Meta</h2>
    		<ul>
    			<?php wp_register(); ?>
    			<li><?php wp_loginout(); ?></li>
    			<li><a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform.">WordPress</a></li>
    			<li><a href="http://gmpg.org/xfn/"><abbr title="XHTML Friends Network">XFN</abbr></a></li>
    			<li><a href="http://validator.w3.org/check/referer" title="This page validates as XHTML 1.0 Transitional">Valid <abbr title="eXtensible HyperText Markup Language">XHTML</abbr></a></li>
    			<li><a href="http://jigsaw.w3.org/css-validator/check/referer" title="This site emits a Valid CSS">Valid <abbr title="Cascading Style Sheets">CSS</abbr></a></li>
    			<?php wp_meta(); ?>
    
    		</ul>
       </li>
      <?php }?>
      <?php endif; ?>
  2. MichaelH
    Member
    Posted 7 years ago #

    You will want to delete the 3 or 4 lines after these two lines

    <?php wp_register(); ?>
    <li><?php wp_loginout(); ?></li>

    But just make a copy of the file before you edit it, make your edits, test how your site looks, make more edits to get it the way you want. You always have the original file to fall back to.

  3. cartpauj
    Member
    Posted 7 years ago #

    I would like the other links to show up only if I'm logged in as an admin. Is there any way to check and see if admin is logged in? Like is_admin or is_logged_in or something like that?

  4. MichaelH
    Member
    Posted 7 years ago #

    This search of the forums http://wordpress.org/search/logged+in?forums=1 produced a number of results including this this thread with this example:

    <?php if ( $user_ID ) : ?>
    User is logged in
    <?php else : ?>
    User is not logged in
    <?php endif; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags