I'm customizing the admin edit.php screen and I have a column that displays a meta key $gear
. But it only lists the first value instead of returning a list of all the values. Here's the bit that matters:
add_action( 'manage_artists_posts_custom_column', 'manage_artists_columns', 10, 2 );
function manage_artists_columns( $column, $post_id ) {
global $post;
switch( $column ) {
case 'gear' :
$gear = get_post_meta( $post_id, 'gear', true );
if ( empty( $gear ) )
echo __( '' );
else
printf( __( '%s' ), $gear );
break;
default :
break;
}
}
I use a similar get_post_meta()
call on the front end that uses
if( $gear = get_post_meta($post->ID, 'gear')
echo implode( $gear, ', ' );
but I couldn't get it to adapt to this application. How do i get printf to output all values?
__()
inside aprintf()
call here? There's nothing to be translated. Also, what do you get withvar_dump( $gear )
?var_dump( $gear )
are you referring to the single post code? $gear is a custom field I've set up so the gear each artist uses can be attached to their profile.