$label ) {
if ( 'title' === $key ) {
$new['at_photo'] = __( 'Photo', 'advanced-testimonial' );
}
$new[ $key ] = $label;
if ( 'title' === $key ) {
$new['at_company'] = __( 'Company', 'advanced-testimonial' );
$new['at_rating'] = __( 'Rating', 'advanced-testimonial' );
}
}
return $new;
}
/**
* Render the content of a custom column.
*
* @param string $column Column key.
* @param int $post_id Post ID.
* @return void
*/
public function render_column( $column, $post_id ) {
switch ( $column ) {
case 'at_photo':
if ( has_post_thumbnail( $post_id ) ) {
echo get_the_post_thumbnail( $post_id, array( 48, 48 ), array( 'class' => 'at-col-photo' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- core returns safe markup.
} else {
echo '☺';
}
break;
case 'at_company':
$company = get_post_meta( $post_id, Helpers::meta_key( 'company' ), true );
echo $company ? esc_html( $company ) : '—';
break;
case 'at_rating':
$rating = Helpers::clamp_rating( get_post_meta( $post_id, Helpers::meta_key( 'rating' ), true ) );
$stars = Helpers::stars_text( $rating );
if ( '' === $stars ) {
echo '—';
} else {
$rating_disp = rtrim( rtrim( number_format( $rating, 1 ), '0' ), '.' );
/* translators: %s: rating out of 5, e.g. 4.5. */
echo '' . esc_html( $stars ) . '';
}
break;
}
}
}