How to display post excerpt beside post list inside Post of Dashboard

Please add follwing line of code in your theme’s function.php to display a new column which will display excerpt in your posts.

function pkb_get_excerpt($post_ID) {
    $content_post = get_post($post_ID);
$content = $content_post->post_content;
    if ($content) {
      return $content;
    }
}

// ADD NEW COLUMN
function pkb_columns_head($defaults) {
    $defaults['excerpt'] = 'excerpt';
    return $defaults;
}

// SHOW THE EXCERPT
function pkb_columns_content($column_name, $post_ID) {
    if ($column_name == 'excerpt') {
        $post_content = pkb_get_excerpt($post_ID);
        echo $str1= substr ($post_content,0,50);

    }
}

add_filter('manage_posts_columns', 'pkb_columns_head');
add_action('manage_posts_custom_column', 'pkb_columns_content', 10, 2);

Please feel free to ask if you have any queries.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)