$post->post_type,
'author' => get_the_author_meta( 'ID' )
);
echo $this->get_edit_link( $args, get_the_author() );
}
/**
* Handles the default column output.
*
* @since 4.3.0
* @access public
*
* @param WP_Post $post The current WP_Post object.
* @param string $column_name The current column name.
*/
public function column_default( $post, $column_name ) {
if ( 'categories' === $column_name ) {
$taxonomy = 'category';
} elseif ( 'tags' === $column_name ) {
$taxonomy = 'post_tag';
} elseif ( 0 === strpos( $column_name, 'taxonomy-' ) ) {
$taxonomy = substr( $column_name, 9 );
} else {
$taxonomy = false;
}
if ( $taxonomy ) {
$taxonomy_object = get_taxonomy( $taxonomy );
$terms = get_the_terms( $post->ID, $taxonomy );
if ( is_array( $terms ) ) {
$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;
}
$label = esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) );
$out[] = $this->get_edit_link( $posts_in_term_qv, $label );
}
/* translators: used between list items, there is a space after the comma */
echo join( __( ', ' ), $out );
} else {
echo '—' . $taxonomy_object->labels->no_terms . '';
}
return;
}
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 {
/**
* 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 );
}
/**
* @global WP_Post $post
*
* @param int|WP_Post $post
* @param int $level
*/
public function single_row( $post, $level = 0 ) {
$global_post = get_post();
$post = get_post( $post );
$this->current_level = $level;
$GLOBALS['post'] = $post;
setup_postdata( $post );
$classes = 'iedit author-' . ( get_current_user_id() == $post->post_author ? 'self' : 'other' );
$lock_holder = wp_check_post_lock( $post->ID );
if ( $lock_holder ) {
$classes .= ' wp-locked';
}
if ( $post->post_parent ) {
$count = count( get_post_ancestors( $post->ID ) );
$classes .= ' level-'. $count;
} else {
$classes .= ' level-0';
}
?>
single_row_columns( $post ); ?>
post_type );
$can_edit_post = current_user_can( 'edit_post', $post->ID );
$actions = array();
$title = _draft_or_post_title();
if ( $can_edit_post && 'trash' != $post->post_status ) {
$actions['edit'] = sprintf(
'%s',
get_edit_post_link( $post->ID ),
/* translators: %s: post title */
esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ),
__( 'Edit' )
);
$actions['inline hide-if-no-js'] = sprintf(
'%s',
/* translators: %s: post title */
esc_attr( sprintf( __( 'Quick edit “%s” inline' ), $title ) ),
__( 'Quick Edit' )
);
}
if ( current_user_can( 'delete_post', $post->ID ) ) {
if ( 'trash' === $post->post_status ) {
$actions['untrash'] = sprintf(
'%s',
wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ),
/* translators: %s: post title */
esc_attr( sprintf( __( 'Restore “%s” from the Trash' ), $title ) ),
__( 'Restore' )
);
} elseif ( EMPTY_TRASH_DAYS ) {
$actions['trash'] = sprintf(
'%s',
get_delete_post_link( $post->ID ),
/* translators: %s: post title */
esc_attr( sprintf( __( 'Move “%s” to the Trash' ), $title ) ),
_x( 'Trash', 'verb' )
);
}
if ( 'trash' === $post->post_status || ! EMPTY_TRASH_DAYS ) {
$actions['delete'] = sprintf(
'%s',
get_delete_post_link( $post->ID, '', true ),
/* translators: %s: post title */
esc_attr( sprintf( __( 'Delete “%s” permanently' ), $title ) ),
__( 'Delete Permanently' )
);
}
}
if ( is_post_type_viewable( $post_type_object ) ) {
if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) {
if ( $can_edit_post ) {
$unpublished_link = set_url_scheme( get_permalink( $post ) );
$preview_link = get_preview_post_link( $post, array(), $unpublished_link );
$actions['view'] = sprintf(
'%s',
esc_url( $preview_link ),
/* translators: %s: post title */
esc_attr( sprintf( __( 'Preview “%s”' ), $title ) ),
__( 'Preview' )
);
}
} elseif ( 'trash' != $post->post_status ) {
$actions['view'] = sprintf(
'%s',
get_permalink( $post->ID ),
/* translators: %s: post title */
esc_attr( sprintf( __( 'View “%s”' ), $title ) ),
__( 'View' )
);
}
}
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 );
}
return $this->row_actions( $actions );
}
/**
* Outputs the hidden row displayed when inline editing
*
* @since 3.1.0
*
* @global string $mode
*/
public function inline_edit() {
global $mode;
$screen = $this->screen;
$post = get_default_post_to_edit( $screen->post_type );
$post_type_object = get_post_type_object( $screen->post_type );
$taxonomy_names = get_object_taxonomies( $screen->post_type );
$hierarchical_taxonomies = array();
$flat_taxonomies = array();
foreach ( $taxonomy_names as $taxonomy_name ) {
$taxonomy = get_taxonomy( $taxonomy_name );
$show_in_quick_edit = $taxonomy->show_in_quick_edit;
/**
* Filter whether the current taxonomy should be shown in the Quick Edit panel.
*
* @since 4.2.0
*
* @param bool $show_in_quick_edit Whether to show the current taxonomy in Quick Edit.
* @param string $taxonomy_name Taxonomy name.
* @param string $post_type Post type of current Quick Edit post.
*/
if ( ! apply_filters( 'quick_edit_show_taxonomy', $show_in_quick_edit, $taxonomy_name, $screen->post_type ) ) {
continue;
}
if ( $taxonomy->hierarchical )
$hierarchical_taxonomies[] = $taxonomy;
else
$flat_taxonomies[] = $taxonomy;
}
$m = ( isset( $mode ) && 'excerpt' === $mode ) ? 'excerpt' : 'list';
$can_publish = current_user_can( $post_type_object->cap->publish_posts );
$core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true );
?>