Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Prefix_Custom_Admin_Columns extends MB_Admin_Columns_Post {
- public function columns( $columns ) {
- $columns = parent::columns( $columns );
- /**
- * Add more column in a specific position
- *
- * @param string $position New column position. Empty to not specify the position. Could be 'before', 'after' or 'replace'
- * @param string $target The target column. Used with combination with $position
- */
- $this->add( $columns, 'col_category', 'Category', 'after', 'title' );
- $this->add( $columns, 'col_featured_image', 'Image', 'after', 'title' );
- return $columns;
- }
- public function show( $column, $post_id ) {
- switch ( $column ) {
- case 'col_featured_image':
- // the_post_thumbnail(array(70,70));
- echo get_the_post_thumbnail( $post_id, array( 70, 70 ) );
- break;
- case 'col_category':
- $terms = get_the_terms( $post_id, 'brand-category' );
- $terms = wp_list_pluck( $terms, 'name' );
- echo implode( ', ', $terms );
- break;
- }
- }
- }
- new Prefix_Custom_Admin_Columns( 'post', array() );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement