Up to 50 percent off

Adding taxonomy to dashboard

This topic contains 2 reply and 2 voices, and was last updated by Sekander Badsha 10 years, 1 month ago
Viewing 2 Posts - 1 through 2 (of 2 total)
Author Posts
October 12, 2014 at 6:09 pm 28225
Sekander Badsha I used the code on this page to add a function to add a column to the dashboard for a custom taxonomy: http://docs.wedevs.com/adding-columns-to-dashboard-table/ The taxonomy column appears but the taxonomy doesn't display, just "---" How do I change the second part of the code to display the info in the column? The name of the taxonomy is "Platform" [php] /** Add a new column header in dashboard table **/ function wpufe_dashboard_change_head( $args ) { printf( '<th>%s</th>', __( 'Platform', 'wpuf' ) ); } add_action( 'wpuf_dashboard_head_col', 'wpufe_dashboard_change_head' ); /** Add a new table cell to the dashboard table rows. **/ function wpufe_dashboard_row_col( $args, $post ) { ?> <td> <?php if ( $sub = get_post_meta( $post->ID, 'subhead', true ) ) { echo $sub; } else { echo '---'; } ?> </td> <?php } add_action( 'wpuf_dashboard_row_col', 'wpufe_dashboard_row_col', 10, 2 ); [/php] thanks!
October 12, 2014 at 6:24 pm 28227
Donald Donald

I can get other info to display in the column when replacing “subhead”, for example with the Meta Key of a Dropdown Field.
But when I replace “subhead” with “platform” for this taxonomy, it doesn’t work.
Thanks

October 16, 2014 at 1:15 pm 28519
Sekander Badsha Sekander Badsha

Hello Donald,
You’re doing it wrong. For taxonomy you have to use wp_get_post_terms
Here is the official documentation of WordPress about that http://codex.wordpress.org/Function_Reference/wp_get_post_terms

Viewing 2 Posts - 1 through 2 (of 2 total)