Guest User

Untitled

a guest
Mar 28th, 2017
121
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

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×