How to change Admin Wordpress post list template for CPT?

I'm trying to change the back end post listing template for a custom post I added to wordpress. For clarity, the image below shows what I mean by "Post listing template":

The regular post listing template shows "Title", "Author", "Categories", "Tags", "Languages", and "Date" fields. However, my custom post has extra functionality and other custom fields I'd like to add to this template, but I can't find the method.

Answers


Well what would you like to add? Most likely you'll have to go digging in Wordpress code to change that. I've never seen a plugin for this kind of functionality. What more do you want added?

The code you would need to look into is "/wp-admin/edit.php". It's quite a long and reasonably complex file. So good luck.


Found the answer! The "manage__posts_columns" filter can be used for modifying the displayed columns. The "manage_posts_custom_column" action can be used for modifying the content of these columns. Code Example for adding custom columns:

function change_columns( $cols ) {
  $cols = array(
    'cb'       => '<input type="checkbox" />',
    'title'      => __( 'Title',      'trans' ),
    'vin'      => __( 'Vin #',      'trans' ),
    'make' => __( 'Make', 'trans' ),
    'model'     => __( 'Model', 'trans' ),
    'year'     => __( 'Year', 'trans' ),
    'color'     => __( 'Color', 'trans' ),
    'thumbnail'     => __( 'Image', 'trans' ),
  );
  return $cols;
}
add_filter( "manage_tek_car_post_posts_columns", "change_columns" );

Code Example for adding content to these columns:

function custom_columns( $column, $post_id ) {
  switch ( $column ) {
    case "vin":
      $colvin = get_post_meta( $post_id, 'vin', true);
      echo $colvin;
      break;
    case "make":
      $colmake = get_post_meta( $post_id, 'carmake', true);
      echo $colmake;
      break;
    case "model":
      $colmodel = get_post_meta( $post_id, 'carmodel', true);
      echo $colmodel;
      break;
    case "year":
      $colyear = get_post_meta( $post_id, 'caryear', true);
      echo $colyear;
      break;
    case "color":
      $colcolor = get_post_meta( $post_id, 'excolor', true);
      echo $colcolor;
      break;
  }
}

add_action( "manage_posts_custom_column", "custom_columns", 10, 2 );

Source: http://yoast.com/custom-post-type-snippets/


I just added something like this under wp-admin/includes/class-wp-list-table.php

<table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>" cellspacing="0">
<thead>
<tr>
SWapnesh
</tr>

and its all getting correctly on wp-admin/edit.php page (code is around line num 775 in my wordpress)


Need Your Help

selected 3D model on camera view in vuforia SDK

ios7 augmented-reality vuforia

I am working on augmented reality project using vuforia unity extension for iOS. I have a list of 3d models(.3ds). i want 3D models should placed on camera view when user selected a model from that...

PHP MAILER: Root User replace From Information

php email root mailer

This event happens so randomly and I have no clue as to why. Information that appears looks like this.