<?php
// Свои стили в админке для для иконок кастомтайпа и тд
add_action('admin_head', 'my_custom_admin_css');
function my_custom_admin_css() {
echo '<style>
li#menu-posts-workers img,
li#menu-posts-public_procurement img {
max-width: 70%;
margin-top: -3px;
}
</style>';
}
// =======================
// Колонка с изображением записи для всех типов постов
// START
// =======================
/* Add the post thumbnail to admin panel - marcokuemmel.de*/
function my_custom_column_content($column)
{
if ($column == 'featuredimage') {
global $post;
echo (has_post_thumbnail($post->ID)) ? the_post_thumbnail(array(80,80)) : '<p>kein Bild festgelegt</p>' ;
}
}
// for cpt use manage_{$post_type}_posts_custom_column
add_action('manage_posts_custom_column', 'my_custom_column_content');
function my_custom_column_setup($columns)
{
return array_merge($columns, array('featuredimage'=>'Artikelbild'));
}
// replace posts with name of the post type to add the column on other post types
add_filter('manage_edit-posts_columns', 'my_custom_column_setup');
function my_admin_head()
{
// echo '<style type="text/css"> body.wp-admin table.wp-list-table .column-featuredimage { width:10%; } </style>';
}
add_action('admin_head', 'my_admin_head');
// =======================
// END
// Колонка с изображением записи для всех типов постов
// =======================