SHARE
TWEET

Untitled

a guest Mar 28th, 2017 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. class Prefix_Custom_Admin_Columns extends MB_Admin_Columns_Post {
  3.     public function columns( $columns ) {
  4.         $columns = parent::columns( $columns );
  5.         /**
  6.          * Add more column in a specific position
  7.          *
  8.          * @param string $position New column position. Empty to not specify the position. Could be 'before', 'after' or 'replace'
  9.          * @param string $target The target column. Used with combination with $position
  10.          */
  11.         $this->add( $columns, 'col_category', 'Category', 'after', 'title' );
  12.         $this->add( $columns, 'col_featured_image', 'Image', 'after', 'title' );
  13.         return $columns;
  14.     }
  15.  
  16.     public function show( $column, $post_id ) {
  17.         switch ( $column ) {
  18.             case 'col_featured_image':
  19. //              the_post_thumbnail(array(70,70));
  20.                 echo get_the_post_thumbnail( $post_id, array( 70, 70 ) );
  21.                 break;
  22.             case 'col_category':
  23.                 $terms = get_the_terms( $post_id, 'brand-category' );
  24.                 $terms = wp_list_pluck( $terms, 'name' );
  25.                 echo implode( ', ', $terms );
  26.                 break;
  27.         }
  28.     }
  29. }
  30.  
  31. new Prefix_Custom_Admin_Columns( 'post', array() );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top