This function seems like it should work, and it mostly does, but what I'm lacking are the values for the 'author' key that ends the list item, prefaced by the text 'By'.
What I'd like is for the function to loop through the taxonomy and return all the custom posts that are ascribed to it, and for each post I'd like to see that custom field's value. Am I using the wrong WP function to call the custom field?
/**
* List custom post type posts of custom taxonomy
*/
function get_all_of_a_taxonomy(){
$post_type = 'entry';
$tax = 'issue';
$tax_terms = get_terms( $tax );
if ($tax_terms) {
foreach ($tax_terms as $tax_term) {
$args = array(
'post_type' => $post_type,
"$tax" => $tax_term->slug,
'post_status' => 'publish',
'posts_per_page' => -1,
'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) : ?>
<?php while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
<li><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a> by <?php echo get_post_meta($post->ID, 'author', true); ?></li>
<?php endwhile;?>
<?php else : ?>
<?php endif; // if have_posts()
wp_reset_query();
}
}
}