我在函数中有thtis函数。php文件
function post_manage_columns($column_name, $id) {
global $post;
switch ($column_name) {
case \'Average\':
echo get_post_meta( $post->ID , \'imdbRating\' , true );
break;
case \'Runtime\':
echo get_post_meta( $post->ID , \'Runtime\' , true );
break;
case \'Poster\':
$poster_path = "https://image.tmdb.org/t/p/w370_and_h556_bestv2".get_post_meta($post->ID, "poster_path", $single = true);
echo \'<img width="53" height="80" src="\'.$poster_path.\'" />\';
break;
case \'years\':
$terms = get_the_term_list( $post_id, \'years\', \'\', \',\', \'\' );
if ( is_string( $terms ) ) {
echo $terms;
} else {
_e( \'Unable to get year\', \'movietv\' );
}
break;
}
}
add_action(\'manage_post_posts_custom_column\', \'post_manage_columns\', 10, 2);
如果$poster\\u路径为空(或此字段没有post meta),我需要一些lik echo