<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}
/*
=================================================================================================================
fasto_column_image_heading - Add column heading Image in dashboard posts
=================================================================================================================
*/
function fasto_column_image_heading( $columns ) {
    if ( get_post_type() == 'post' ){
		$columns['image'] = esc_attr__( 'Image','fasto' );
		return $columns;
	}
}
/*
=================================================================================================================
fasto_column_image - Add column image display in dashboard posts
=================================================================================================================
*/
function fasto_column_image( $column ) {
    if ( get_post_type() == 'post' ){
		
		if ( $column === 'image') {
		   if ( get_post_format() == false ){
			   if ( has_post_thumbnail() ){
					 $post_thumb = get_the_post_thumbnail_url( get_the_ID() , 'fasto-admin-thumb' ) ;
					 echo '<img src=" '. esc_url( $post_thumb ) .' " class="admin-thumb">';
				   }
		   }
			elseif ( get_post_format() == 'video' ){
				echo esc_attr__('Video','fasto');
			}		
			elseif ( get_post_format() == 'audio' ){
				echo esc_attr__('Audio','fasto');
			}
			else{
				echo esc_attr__('Gallery','fasto');
			}
		}
	}
}
add_filter( 'manage_posts_columns', 'fasto_column_image_heading',1 );
add_action( 'manage_posts_custom_column', 'fasto_column_image',1 );