Pour afficher les images à la une dans votre liste d’articles, copiez le code suivant dans le fichier functions.php de votre thème:

/* --- Start : Post Thumbnail in admin --- */
    // Add the posts and pages columns filter. They can both use the same function.
    add_filter('manage_posts_columns', 'tcb_add_post_thumbnail_column', 1);
    add_filter('manage_pages_columns', 'tcb_add_post_thumbnail_column', 1);
 
    // Add the column
    function tcb_add_post_thumbnail_column($cols){
      $cols['tcb_post_thumb'] = __('Image','sensa');
      return $cols;
    }
 
    // Hook into the posts an pages column managing. Sharing function callback again.
    add_action('manage_posts_custom_column', 'tcb_display_post_thumbnail_column', 1, 2);
    add_action('manage_pages_custom_column', 'tcb_display_post_thumbnail_column', 1, 2);
 
    // Grab featured-thumbnail size post thumbnail and display it.
    function tcb_display_post_thumbnail_column($col, $id){
      switch($col){
        case 'tcb_post_thumb':
          if( function_exists('the_post_thumbnail') )
            echo the_post_thumbnail( 'thumb' );
          else
            echo __( 'Not supported in theme','sensa' );
          break;
      }
    }
/* --- End : Post Thumbnail in admin --- */

 

Laisser un commentaire

Your email address will not be published. Required fields are marked *
Pouvez utliser ces tags et attributs HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>