\n";
}
+ if ( ! $this->hierarchical_display && 'excerpt' == $mode && current_user_can( 'read_post', $post->ID ) )
+ the_excerpt();
+
$actions = array();
if ( $can_edit_post && 'trash' != $post->post_status ) {
$actions['edit'] = '' . __( 'Edit' ) . '';
$actions['inline hide-if-no-js'] = '' . __( 'Quick Edit' ) . '';
}
- if ( current_user_can( $post_type_object->cap->delete_post, $post->ID ) ) {
+ if ( current_user_can( 'delete_post', $post->ID ) ) {
if ( 'trash' == $post->post_status )
- $actions['untrash'] = "ID ) ), 'untrash-' . $post->post_type . '_' . $post->ID ) . "'>" . __( 'Restore' ) . "";
+ $actions['untrash'] = "ID ) ), 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "";
elseif ( EMPTY_TRASH_DAYS )
$actions['trash'] = "" . __( 'Trash' ) . "";
if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS )
@@ -547,14 +656,48 @@ class WP_Posts_List_Table extends WP_List_Table {
}
if ( $post_type_object->public ) {
if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) {
- if ( $can_edit_post )
- $actions['view'] = '' . __( 'Preview' ) . '';
+ if ( $can_edit_post ) {
+
+ /** This filter is documented in wp-admin/includes/meta-boxes.php */
+ $actions['view'] = '' . __( 'Preview' ) . '';
+ }
} elseif ( 'trash' != $post->post_status ) {
$actions['view'] = '' . __( 'View' ) . '';
}
}
- $actions = apply_filters( is_post_type_hierarchical( $post->post_type ) ? 'page_row_actions' : 'post_row_actions', $actions, $post );
+ if ( is_post_type_hierarchical( $post->post_type ) ) {
+
+ /**
+ * Filter the array of row action links on the Pages list table.
+ *
+ * The filter is evaluated only for hierarchical post types.
+ *
+ * @since 2.8.0
+ *
+ * @param array $actions An array of row action links. Defaults are
+ * 'Edit', 'Quick Edit', 'Restore, 'Trash',
+ * 'Delete Permanently', 'Preview', and 'View'.
+ * @param WP_Post $post The post object.
+ */
+ $actions = apply_filters( 'page_row_actions', $actions, $post );
+ } else {
+
+ /**
+ * Filter the array of row action links on the Posts list table.
+ *
+ * The filter is evaluated only for non-hierarchical post types.
+ *
+ * @since 2.8.0
+ *
+ * @param array $actions An array of row action links. Defaults are
+ * 'Edit', 'Quick Edit', 'Restore, 'Trash',
+ * 'Delete Permanently', 'Preview', and 'View'.
+ * @param WP_Post $post The post object.
+ */
+ $actions = apply_filters( 'post_row_actions', $actions, $post );
+ }
+
echo $this->row_actions( $actions );
get_inline_data( $post );
@@ -562,7 +705,7 @@ class WP_Posts_List_Table extends WP_List_Table {
break;
case 'date':
- if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) {
+ if ( '0000-00-00 00:00:00' == $post->post_date ) {
$t_time = $h_time = __( 'Unpublished' );
$time_diff = 0;
} else {
@@ -572,17 +715,35 @@ class WP_Posts_List_Table extends WP_List_Table {
$time_diff = time() - $time;
- if ( $time_diff > 0 && $time_diff < 24*60*60 )
+ if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS )
$h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
else
$h_time = mysql2date( __( 'Y/m/d' ), $m_time );
}
echo '
';
- if ( 'excerpt' == $mode )
+ if ( 'excerpt' == $mode ) {
+
+ /**
+ * Filter the published time of the post.
+ *
+ * If $mode equals 'excerpt', the published time and date are both displayed.
+ * If $mode equals 'list' (default), the publish date is displayed, with the
+ * time and date together available as an abbreviation definition.
+ *
+ * @since 2.5.1
+ *
+ * @param array $t_time The published time.
+ * @param WP_Post $post Post object.
+ * @param string $column_name The column name.
+ * @param string $mode The list display mode ('excerpt' or 'list').
+ */
echo apply_filters( 'post_date_column_time', $t_time, $post, $column_name, $mode );
- else
+ } else {
+
+ /** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */
echo '' . apply_filters( 'post_date_column_time', $h_time, $post, $column_name, $mode ) . '';
+ }
echo ' ';
if ( 'publish' == $post->post_status ) {
_e( 'Published' );
@@ -597,46 +758,6 @@ class WP_Posts_List_Table extends WP_List_Table {
echo '
';
+ if ( $terms = get_the_terms( $post->ID, $taxonomy ) ) {
+ $out = array();
+ foreach ( $terms as $t ) {
+ $posts_in_term_qv = array();
+ if ( 'post' != $post->post_type )
+ $posts_in_term_qv['post_type'] = $post->post_type;
+ if ( $taxonomy_object->query_var ) {
+ $posts_in_term_qv[ $taxonomy_object->query_var ] = $t->slug;
+ } else {
+ $posts_in_term_qv['taxonomy'] = $taxonomy;
+ $posts_in_term_qv['term'] = $t->slug;
+ }
+
+ $out[] = sprintf( '%s',
+ esc_url( add_query_arg( $posts_in_term_qv, 'edit.php' ) ),
+ esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) )
+ );
+ }
+ /* translators: used between list items, there is a space after the comma */
+ echo join( __( ', ' ), $out );
+ } else {
+ echo '—';
+ }
+ echo '
';
+ break;
+ }
?>
>post_type ) )
+ if ( is_post_type_hierarchical( $post->post_type ) ) {
+
+ /**
+ * Fires in each custom column on the Posts list table.
+ *
+ * This hook only fires if the current post type is hierarchical,
+ * such as pages.
+ *
+ * @since 2.5.0
+ *
+ * @param string $column_name The name of the column to display.
+ * @param int $post_id The current post ID.
+ */
do_action( 'manage_pages_custom_column', $column_name, $post->ID );
- else
+ } else {
+
+ /**
+ * Fires in each custom column in the Posts list table.
+ *
+ * This hook only fires if the current post type is non-hierarchical,
+ * such as posts.
+ *
+ * @since 1.5.0
+ *
+ * @param string $column_name The name of the column to display.
+ * @param int $post_id The current post ID.
+ */
do_action( 'manage_posts_custom_column', $column_name, $post->ID );
+ }
+
+ /**
+ * Fires for each custom column of a specific post type in the Posts list table.
+ *
+ * The dynamic portion of the hook name, $post->post_type, refers to the post type.
+ *
+ * @since 3.1.0
+ *
+ * @param string $column_name The name of the column to display.
+ * @param int $post_id The current post ID.
+ */
do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID );
?>