I'm hoping someone can help me here. I want to put the the_author_login in the header of my site. I just can't work out how to start the loop in there. This is the code i'm using:
<?php if (is_home()) : ?>
Welcome: <?php the_author_login(); ?>
<?php endif; ?>
I'm sure the if clause is bad, but I couldn't think of anything else to use. It shows the 'Welcome:' bit but not the_author_login - so I guess the loop isn't working.
Any ideas what I've done wrong?
thanks in advance
Hami
Try this:
Welcome:
<?php
if (have_posts()){
the_post();
the_author_login();
}
?>
From the codex: Displays the login name for the author of a post.
So..... how can it be in the header? It's going to need to go with the posts that the author wrote....
-tg`
Thanks Lynx,
That code breaks the posts and replaces it with 'No Posts Found', but does put what I wanted in the header.
But TechGnome is right I shouldn't be using the_author_login, it's the wrong tag. What I want to do is put the current logged in user's name in the header - Welcome: Username
Do you know if this can be done?
thanks
Hami