WP_Media_List_Table::column_title()
Handles the title column output.
Метод класса: WP_Media_List_Table{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$WP_Media_List_Table = new WP_Media_List_Table(); $WP_Media_List_Table->column_title( $post );
- $post(WP_Post) (обязательный)
- The current WP_Post object.
Список изменений
С версии 4.3.0 | Введена. |
Код WP_Media_List_Table::column_title() WP Media List Table::column title WP 6.6.1
<?php public function column_title( $post ) { list( $mime ) = explode( '/', $post->post_mime_type ); $attachment_id = $post->ID; if ( has_post_thumbnail( $post ) ) { $thumbnail_id = get_post_thumbnail_id( $post ); if ( ! empty( $thumbnail_id ) ) { $attachment_id = $thumbnail_id; } } $title = _draft_or_post_title(); $thumb = wp_get_attachment_image( $attachment_id, array( 60, 60 ), true, array( 'alt' => '' ) ); $link_start = ''; $link_end = ''; if ( current_user_can( 'edit_post', $post->ID ) && ! $this->is_trash ) { $link_start = sprintf( '<a href="%s" aria-label="%s">', get_edit_post_link( $post->ID ), /* translators: %s: Attachment title. */ esc_attr( sprintf( __( '“%s” (Edit)' ), $title ) ) ); $link_end = '</a>'; } $class = $thumb ? ' class="has-media-icon"' : ''; ?> <strong<?php echo $class; ?>> <?php echo $link_start; if ( $thumb ) : ?> <span class="media-icon <?php echo sanitize_html_class( $mime . '-icon' ); ?>"><?php echo $thumb; ?></span> <?php endif; echo $title . $link_end; _media_states( $post ); ?> </strong> <p class="filename"> <span class="screen-reader-text"> <?php /* translators: Hidden accessibility text. */ _e( 'File name:' ); ?> </span> <?php $file = get_attached_file( $post->ID ); echo esc_html( wp_basename( $file ) ); ?> </p> <?php }