WP_Media_List_Table::column_title( WP_Post $post )
- Since
- 4.3.0
- Source
wp-admin/includes/class-wp-media-list-table.php:442
Handles the title column output.
Parameters
$postWP_Post- The current WP_Post object.
Uses · 14
- has_post_thumbnail()Determines whether a post has an image attached.
- get_post_thumbnail_id()Retrieves the post thumbnail ID.
- _draft_or_post_title()Gets the post title.
- wp_get_attachment_image()Gets an HTML img element representing an image attachment.
- current_user_can()Returns whether the current user has the specified capability.
- get_edit_post_link()Retrieves the edit post link for post.
- esc_attr()Escaping for HTML attributes.
- __()Retrieves the translation of $text.
- sanitize_html_class()Sanitizes an HTML classname to ensure it only contains valid characters.
- _media_states()Outputs the attachment media states as HTML.
- _e()Displays translated text.
- get_attached_file()Retrieves attached file path based on attachment ID.
Show all 14
- esc_html()Escaping for HTML blocks.
- wp_basename()i18n-friendly version of basename().
Source
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 }History
Introduced in 4.3.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.8.8 tag, from
src/wp-admin/includes/class-wp-media-list-table.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.