Skip Navigation

[Resolved] Back end customization: adding category column to overview + sorting on taxonomy

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 11 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 -
- - - - - - -

Supporter timezone: Europe/Madrid (GMT+01:00)

Tagged: 

This topic contains 6 replies, has 4 voices.

Last updated by David 10 years, 5 months ago.

Assisted by: Caridad.

Author
Posts
#22744

Eva

Hi,

I'm having a question about Types.

I was wondering if it is possible to add a column for your custom taxonomy on a custom post type overview in the back end.

Eg: I have created a custom post type called 'products' and a custom taxonomy 'brands'. I would like to be able to see what 'brand' a product has from the product overview. Similar to how the posts overview page works really. This is especially useful if you have lots of posts, otherwise you always have to check via the quick edit function what category the post is under.

Additionally: is it possible to add a sorting function to the top of the overview page (again, similar to the native posts overview) where you can sort per category?

If anyone can point me in the right direction it would be much appreciated!

#22753

Dear Eva,

This is in our requests list, but it hasnt been scheduled yet. Meanwhile you can use the code suggested in this post:

https://toolset.com/forums/topic/add-taxonomy-filter-to-admin-posts-menu/#post-12956

Here we are using articles and publication in the same way you want.

Please let me know if there is anything else that I can assist you with.

Regards,
Caridad

#22759

Eva

Thanks for your fast response!

I'm taking you have to substitute the 'publication' in the example with the slug of your custom taxonomy. I tried that with two separate themes but it doesn't seem to work. Am i doing something wrong? > see code below, my custom taxonomy is called 'secties' (slug).

 function add_new_columns($defaults) {
$defaults['secties'] = 'Secties';
return $defaults;
}
function add_column_data( $column_name, $post_id ) {
if( $column_name == 'secties' ) {
$terms = get_the_terms( $post_id, 'secties' );
if ( !empty( $terms ) ) {
$out = array();
foreach ( $terms as $c ) $out[] = $c->name;
echo implode( ', ', $out );
} else {
echo 'Not published';
}
}
}
add_filter( 'manage_article_posts_columns', 'add_new_columns' );
add_action( 'manage_posts_custom_column', 'add_column_data', 10, 2 );	   
#22766

Dear Eva,

You also have to replace article with the slug of your custom type. This is part of the name of the filter.

Please let me know if there is anything else that I can assist you with.

Regards,
Caridad

#22767

Eva

Ah, i missed that one. Thank you very much for your help!

#96948
#154781

rober-

Thanks for the tip on the CodePress Admin Columns. Just tried it out and worked perfectly!!

The forum ‘Types Community Support’ is closed to new topics and replies.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.