title: how to get avatar on front end wordpress
body: <p>Hello users of stack over flow, I have a little Question, </p>
  
  <p>I am trying to get avatar in upper end of my website, if user is logged in I want to show </p>
  
  <p>avatar and name and link to profile, </p>
  
  <p>if user is not logged in I want to show login and register buttons </p>
  
  <p>I know little bit of php only , I will have to use if else statement but how to call wordpress logged in user function , </p>
  
  <p>thanks</p>
  
  <p>(if you provide me with a sample code that will help a lot)</p>
  
  <p>I tried something like this </p>
  
  <pre><code> &lt;ul class="nav-userbox nav pull-right"&gt;
  &lt;?php
  if ( is_user_logged_in() ) {
    echo 'Welcome, registered user!';
  
   &lt;li id="menuLogin" class="dropdown"&gt;
          &lt;a class="user-buttons" title="Register" href="./register?to="&gt;
  
              Register
  
          &lt;/a&gt;
          &lt;a id="navLogin" class="dropdown-toggle user-buttons" data-toggle="dropdown" href="#"&gt;
  
              Login
  
          &lt;/a&gt;
          &lt;div class="dropdown-menu login-form"&gt;
              &lt;form id="loginform" method="post" action="./login?to="&gt;
                  &lt;input id="user_login" type="text" placeholder="Email or Username" name="log"&gt;&lt;/input&gt;
                  &lt;input id="user_pass" type="password" placeholder="Password" name="pwd"&gt;&lt;/input&gt;
                  &lt;label class="checkbox inline"&gt;
                      &lt;input id="rememberme" type="checkbox" value="forever" name="rememberme"&gt;&lt;/input&gt;
  
                       Remember                       
  
                  &lt;/label&gt;
      &lt;input id="wp-submit" type="submit" value="Log In" name="wp-submit"&gt;&lt;/input&gt;
      &lt;input type="hidden" value="http://www.entrytestclass.com/main21/wp-admin/" name="redirect_to"&gt;&lt;/input&gt;
      &lt;input type="hidden" value="" name="instance"&gt;&lt;/input&gt;
      &lt;input type="hidden" value="login" name="action"&gt;&lt;/input&gt;
  
              &lt;/form&gt;
  
              &lt;div class="custom"&gt;
                  &lt;div id="fb-root" class=" fb_reset" style="display:inline;"&gt;
                      &lt;div style="position: absolute; top: -10000px; height: 0px; width: 0px;"&gt;&lt;/div&gt;
                      &lt;div style="position: absolute; top: -10000px; height: 0px; width: 0px;"&gt;&lt;/div&gt;
                  &lt;/div&gt;
                  &lt;script&gt;
  
  
                              window.fbAsyncInit = function() {
                             …
  
                  &lt;/script&gt;
                  &lt;div class="fb-login-button fb_iframe_widget" scope="email,user_about_me,user_location,user_website" size="medium" style="display:inline; vertical-align:middle;" login_text=" " fb-xfbml-state="rendered" fb-iframe-plugin-query="app_id=332446126861609&amp;locale=en_US&amp;login_text=%0A%20%20%20%…about_me%2Cuser_location%2Cuser_website&amp;sdk=joey&amp;size=medium"&gt;
                      &lt;span style="vertical-align: bottom; width: 0px; height: 0px;"&gt;
                          &lt;iframe class="" height="1000px" frameborder="0" width="1000px" scrolling="no" name="f27f166a4e97fde" allowtransparency="true" title="fb:login_button Facebook Social Plugin" style="border: medium none; visibility: visible; width: 0px; height: 0px;" src="http://www.facebook.com/plugins/login_button.php?app_id=3324…about_me%2Cuser_location%2Cuser_website&amp;sdk=joey&amp;size=medium"&gt;&lt;/iframe&gt;
                      &lt;/span&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/li&gt;
  
      }
      ?&gt;
  
  &lt;/ul&gt;
  </code></pre>
  
  <p>But I got erros , Please can someone tell me what I am doing wrong</p>