Summery Summery
Handles the parent column output.
Syntax Syntax
Parameters Parameters
- $post
-
(Required) The current WP_Post object.
Source Source
File: wp-admin/includes/class-wp-media-list-table.php
$time = get_post_timestamp( $post ); $time_diff = time() - $time; if ( $time && $time_diff > 0 && $time_diff < DAY_IN_SECONDS ) { /* translators: %s: Human-readable time difference. */ $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) ); } else { $h_time = get_the_time( __( 'Y/m/d' ), $post ); } } echo $h_time; } /** * Handles the parent column output. * * @since 4.3.0 * * @param WP_Post $post The current WP_Post object. */ public function column_parent( $post ) { $user_can_edit = current_user_can( 'edit_post', $post->ID ); if ( $post->post_parent > 0 ) { $parent = get_post( $post->post_parent ); } else { $parent = false; } if ( $parent ) { $title = _draft_or_post_title( $post->post_parent ); $parent_type = get_post_type_object( $parent->post_type ); if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $post->post_parent ) ) { ?> <strong><a href="<?php echo get_edit_post_link( $post->post_parent ); ?>"> <?php echo $title; ?></a></strong> <?php } elseif ( $parent_type && current_user_can( 'read_post', $post->post_parent ) ) { ?> <strong><?php echo $title; ?></strong> <?php } else { _e( '(Private post)' ); } if ( $user_can_edit ) : $detach_url = add_query_arg( array( 'parent_post_id' => $post->post_parent, 'media[]' => $post->ID, '_wpnonce' => wp_create_nonce( 'bulk-' . $this->_args['plural'] ), ), 'upload.php' ); printf( '<br /><a href="%s" class="hide-if-no-js detach-from-parent" aria-label="%s">%s</a>', $detach_url,
Advertisement
Changelog Changelog
Version | Description |
---|---|
4.3.0 | Introduced. |