0

So I have created a custom post type with custom values and customize my custom post type admin columns.

You can see here how my custom post type is looking in admin panel.

And as you can see I can order by title all posts and I was wondering if I could do same for all columns, like "info" etc.

Is it possible?

I am using this code, to display columns like I wanna :

//display catalog products in nice list
add_action("manage_posts_custom_column",  "catalog_custom_columns");
add_filter("manage_edit-catalog_columns", "catalog_edit_columns");

function catalog_edit_columns($columns){
  $columns = array(
    "cb" => "<input type=\"checkbox\" />",
    "title" => "Product Title",
    "description" => "Info",
    "skills" => "Category",
     "year" => "Price",

  );

  return $columns;
}



function catalog_custom_columns($column){
  global $post;

  switch ($column) {
    case "description":
      the_content();
      break;
     case "skills":
      echo get_the_term_list($post->ID, 'atrakcijas', '', ', ','');
      break;
    case "year":
      $custom = get_post_custom();
      echo $custom["product_price"][0]; ?>Ls<?php
      break;

  }
}

1 Answer 1

0

Scribu as written a great detailed tutorial named "Create your own sortable columns" just what you need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.