1

How to add this column ( last revision of Post ) on All Posts Manager. I can't find discussion about this problem. Please help me or suggest me an idea. Thanks for all !

Add last revision of Post column

1

I'm not 100% sure exactly what you wish to place in the 'last revision' column, but just so you are aware you can switch the view on the Posts table to Excerpt View using the button below the search box. This view allows you to see the first few lines of the post as well as all of the other default information -

Excerpt View

Please see this page for more information on the Edit Posts screen - http://en.support.wordpress.com/posts/edit-posts-screen/

But anyway, you can add extra columns to every post type by placing the code below in your functions.php file and amending as required, should you still wish.

This example shows you how to add an ID column, but if you give more details on exactly what you want to add I'll happily provide further examples if required.

/**
 * Hook into the WP_List_Table designs to add custom columns
 */
add_action('init', 'my_setup_custom_columns');
function my_setup_custom_columns(){

    /** Add columns on the WP_Posts_List_Table for all post types */
    add_filter("manage_posts_columns", 'my_add_custom_columns', 11);

    /** Populate all additional columns */
    add_action('manage_posts_custom_column', 'my_fill_custom_columns_echo', 11, 2);

}

/**
 * Add additional custom columns to the list table views in the admin area
 *
 * @param required array $columns   The columns that currently exist
 */
function my_add_custom_columns($columns){

    $new_columns = array();

    $new_columns['my_item_id'] = __('ID', 'your-text-domain);

    $columns = $columns + $new_columns;

    return $columns;

}

/**
 * Fill the custom columns by outputting data
 *
 * @param required string $column_name  The name of the column to return data for
 * @param required integer $object_id   The ID of the curent object to fill the column for
 */
function my_fill_custom_columns_echo($column_name, $object_id){

    switch($column_name) :

        /**
         * ID (the ID of the current object)
         */
        case 'my_item_id' :
            echo $object_id;
            break;

    endswitch;
}

And you can style the column if you wish (to give it a width) by adding this to your admin style sheet -

.wp-list-table .manage-column.column-my_item_id{
    width: 50px;
}

I'd recommend some reading on this subject for future use as well -

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.