scribu / wp-posts-to-posts

Efficient many-to-many connections between posts, pages, custom post types, users.
http://wordpress.org/plugins/posts-to-posts/
974 stars 261 forks source link

Customizing the box display #266

Open carambula opened 12 years ago

carambula commented 12 years ago

Hello!

I'd like to extend the display of the box.

Ideally, like fields, pass an attribute of the post and have it show as a label in it's own column.

IE: Display post thumbnail after delete, before title.

Ideally this would work for both connected posts as well as suggested posts/search results.

I understand I can roll my own box but I love the way you've put it together with search and sorting. I have considered fully recreating the box as a custom and then adding the thumbnails but that seems foolish, as does editing the plugin.

Thanks,

Aaron.

scribu commented 12 years ago

I could imagine opening up the API for adding custom columns. Each column would need to be a new PHP class, with at least two methods: render() and save().

carambula commented 12 years ago

With save being optional in order to simply display?

I've begun some experimentation appending thumbnails to the name and the potential, I think, is great: http://cl.ly/image/3H0J3E2C3z3s (this is a hack in box.php, not an extension of the API yet)

I've also found use for showing the connected values in the box just as they are with 'admin_column' though I haven't tried it yet.

carambula commented 12 years ago

I thought about it more and I think something like this would be awesome, using 'get_the' functions:

'admin_box_columns' => array(
  'get_the_title' => true, 
  'get_the_post_thumbnail' => true,
  'get_the_date' => true
)
jazbek commented 11 years ago

+1 for this, I was just about to ask for the same feature (being able to add additional custom columns to the post selection rows). Some of my posts often have duplicate titles and are distinguished only by a meta value or other connections.

I don't think the 'get_the' idea suggested by @carambula would be sufficient for all cases; I'd like to be able to specify a callback to get the column's value.

ryanurban commented 10 years ago

+1 for this, both for the addition of allowing custom columns as well as allowing a callback.