list_authors()
-
Is there a way to get list_authors (or another WordPress API to put user-defined text/code before and after each list item it generates? I would like to generate a page that lists out the authors and puts a picture and some info about each of them. I would rather not use a hack to do this, if I don’t have to. Currently, I’m using this code to generate the list of authors, but I’m at a loss for where to go next.
<?php list_authors(FALSE,TRUE,TRUE,TRUE) ?>Any suggestions would be greatly appreciated. Thanks.
-
the codex page for the template tag you are using answers your question by showing the available parameters.
http://codex.ww.wp.xz.cn/Template_Tags/list_authors
of which what you described is not one of them.
what you need to do is read this:
Hello Dr. Who. Thanks for the pointer! It was very helpful. I decided to change how I’m going about this a little bit. As you can see in the code below, I’m now using PHP to pull the author pic, if it exists. However, for some reason file_exists() keeps returning FALSE when I know for a fact the file is there. Any thoughts?
<?php if(isset($_GET['author_name'])) : $curauth = get_userdatabylogin($author_name); // NOTE: 2.0 bug requires get_userdatabylogin(get_the_author_login()); else : $curauth = get_userdata(intval($author)); endif; ?> ... <?php $filepath = "http://{$_SERVER['HTTP_HOST']}/wp/wp-content/uploads/authors/{$curauth->user_login}.jpg"; if (file_exists($filepath)) : ?> <img class="photo" src="<?php echo $filepath ?>" alt="<?php echo $curauth->display_name; ?>, <?php echo $curauth->nickname; ?>" /> <?php else : ?> <?php echo '' ?> <?php endif; ?>Try an
echo $filepathright after you set the value to see if it’s what you expect.Thanks for the help! I was able to get this working using the Cimy Extra User Fields plugin. 🙂
The topic ‘list_authors()’ is closed to new replies.