I have a few custom fields for a taxonomy "Author". The term title is the Author's last name, and one of the custom fields is his first_name.
Now I need, in a post loop, to list all "Authors" of that post by their full name. How can I do this? I'm using Ultimate CMS plugin to manage taxonomy custom fields.
Just to be clear this is a post type "Academic Article" with the authors as a taxonomy.
Thank you.
-
:). So I see. But I just reviewed my questions and I can't really classify the answers as the solution in two of them. I wouldn't want to misguide users.– AnaRitaFeb 28, 2012 at 15:54
-
So submit your own solutions to the questions so that you help the community.– mor7iferFeb 28, 2012 at 21:56
-
Well, I did not reach a solution myself. I just gave up and went another way. Sorry, but they really are open questions.– AnaRitaFeb 28, 2012 at 22:21
2 Answers
So I decided to go another way. I now have the Author's Full Name as terms in the taxonomy. For the index, for which I need to separate Last Name and First Name, I used PHP string functions.
<?php
$taxonomy = 'autores';
$queried_term = get_query_var($taxonomy);
$terms = get_terms($taxonomy, 'slug='.$queried_term);
if ($terms) {
echo '<div id="indiceAutores-nav"></div> <div id="columns"><ul class="indiceAutores" id="indiceAutores">';
foreach($terms as $term) {
$names=explode(' ',$term->name);
$lastname=array_pop($names);
$firstname= $term->name[0];
echo '<li><a href="'.get_term_link($term->slug, $taxonomy).'">'.$lastname .', ' .$firstname .'.</a></li>';
}
echo '</div></ul>';
}
?>
I also added some jQuery plugins for the final iteration: http://cea.iscte.pt/cadernos/?page_id=80
I had pretty much the same issue, which I posted on the Toolset plugin support page: http://wp-types.com/forums/topic/custom-fieldtaxonomy-for-authors-with-first-name-and-last-name/. One possibility mentioned there was implementing Author as a custom post type, with an intermediary Author-Article post type, which I considered overkill for most academic researchers' purposes.
Here's the simpler (though less elegant) solution I posted there:
There are two main goals for custom author structures in such a site:
List all authors in very particular citation orders. This is to reproduce a formatted citation, and also to sort articles by author. This is accomplished with a custom field "Author list": a single-line field in the format "Lastname1, Firstname1, Firstname2 Lastname2, Firstname3 Lastname3"; use whatever citation format you wish for the author list. If you want to support multiple author list citation fields, then use multiple custom fields. (That would be a pain; in my case, just one format was enough.)
Take advantage of built-in features for grouping academic articles by author. This is accomplished with a custom taxonomy (non-hierarchical, like tags) "Publication author": format "Firstname Lastname".
Whenever you need to display the author list in your desired format(s) and whenever you want to sort articles by author, you can use the "Author list" custom field(s); whenever you want to list all publications by a particular author, you can use the "Publication author" custom taxonomy.
The explode PHP solution for parsing author names works most of the time, but as you surely realize, there are always some author names that break such a formulation (e.g. a name like (Xiao Jean-Phillipe de Guzman, Jr.").