Kostas Vrouvas
Version: 1.2
*/
// Prevent direct access to this file.
if( !defined( 'ABSPATH' ) ) {
exit( 'You are not allowed to access this file directly.' );
}
// Styles
add_action( 'admin_enqueue_scripts', 'safely_add_stylesheet_to_admin' );
function safely_add_stylesheet_to_admin() {
wp_enqueue_style( 'prefix-style', plugins_url('stylesheet.css', __FILE__) );
}
// "The Core"
function custom_columns($columns)
{
$columns['featured_image'] = 'Featured Image';
return $columns;
}
add_filter('manage_posts_columns' , 'custom_columns');
function custom_columns_data($column, $post_id)
{
switch ( $column )
{
case 'featured_image':
if ( has_post_thumbnail() ) {
?>
Set';
}
break;
}
}
add_action( 'admin_enqueue_scripts', 'afi_include_myuploadscript' );
function afi_include_myuploadscript() {
if ( ! did_action( 'wp_enqueue_media' ) ) {
wp_enqueue_media();
}
}
add_action('manage_posts_custom_column', 'custom_columns_data', 10, 2);
add_action('admin_footer', 'afi_featured_js_update');
function afi_featured_js_update() {
global $current_screen;
// add this JS function only if we are on all posts page
if (($current_screen->id != 'edit-post') || ($current_screen->post_type != 'post'))
return;
?>