Kathy_P
Member
Posted 4 years ago #
As I mentioned here, this code isn't working for me consistently. As did the original author of the referenced thread, I want to have the author's name in a heading that comes before the execution of The Loop in an author template. At first I tried it this way:
<?php
if(get_query_var('author_name')) :
$curauth = get_userdatabylogin(get_query_var('author_name'));
else :
$curauth = get_userdata(get_query_var('author'));
endif;
?>
<h3>These are excerpts of all of <?php echo $curauth->user_nickname; ?>'s entries. Click on the title of each entry to view the full post.</h3>
but only two of my nine authors' names showed up that way. Why should that be? They all have nicknames.
So then I remembered that Kafkaesqui, the author of the Get Author Profile plugin, said in his latest update that he made the plugin "template aware." I thought that meant I could use his plugin template tag before The Loop in an author template and WordPress would already know which author to use. So I changed the previous code to
<h3>These are excerpts of all of <?php get_author_profile('nickname'); ?>'s entries. Click on the title of each entry to view the full post.</h3>
and now none of the authors' names show up in this heading. What am I doing wrong?
viitoria
Member
Posted 4 years ago #
From expirience, the plugin didn't work with the author.php page with me, either. The only way I got it to work was specifying the author's id, which blew the whole pupose of the author.php page for me. Instead, I used this method (http://codex.wordpress.org/Author_Templates) and linked my author pages /?author=1
(replace 1 with whatever id you need). Worked like a charm.
<?php get_author_profile(); ?>
<h3>These are excerpts of all of <?php get_author_profile('nickname'); ?>'s entries. Click on the title of each entry to view the full post.</h3>
This works for me in the author.php template on three different server and permalink setups. Should work with either the 0.3 or 0.4 (most recent) release of the plugin.
Hmm. I really should double-check my replies...
<?php get_author_profile(); ?>
<h3>These are excerpts of all of <?php author_profile('nickname'); ?>'s entries. Click on the title of each entry to view the full post.</h3>
*That* is what I meant when I said "this works for me".
Kathy_P
Member
Posted 4 years ago #
I had to look three or four times before I saw the difference between your two replies. As I suspected, I had misunderstood what it meant to be "template aware." I thought that meant I did not have to run <?php get_author_profile(); ?> first. I see now that I was wrong. Hopefully my confusion will help someone else. The way you have it in your second post, calling the information with get_author_profile and displaying it with author_profile('nickname') worked perfectly. Kafkaesqui, I really appreciate the time you have taken on several threads to help me and others understand how to make a full-featured author page.