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

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.

You are not logged in. You can view support threads, but not post.
If you are already logged in, please refresh your browser.

This topic contains 6 replies, has 4 voices, and was last updated by  David 3 years, 1 month ago. The support staff assigned to this topic is Caridad.

Viewing 7 posts - 1 through 7 (of 7 total)
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:

http://wp-types.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!!

Viewing 7 posts - 1 through 7 (of 7 total)

You are not logged in. You can view support threads, but not post.
If you are already logged in, please refresh your browser.

Known issues and their solutions

We document known issues and their solutions in Toolset erratas. Save time by checking there first and seeing if what you are facing is a known issue. This list is kept short. We do our best to resolve all known issues with every release of Toolset plugins.

Support Policy

Toolset staff will help you use the Toolset plugins correctly, provide any information you need, help troubleshoot problems and advice on best-practices.

Please make sure to issue only one topic per each support ticket.

For more information, read our full Customer Support Policy.

Need custom programming work for your site? Check out our certified partners.