Add category column

This topic contains 4 reply and 3 voices, and was last updated by Marie-Hélène 11 years ago
Viewing 4 Posts - 1 through 4 (of 4 total)
Author Posts
September 3, 2013 at 8:43 pm 7764
Marie-Hélène How to add category column in frontend dashborad? I would like to display the category name for each post on user's dashboard. I've read http://docs.wedevs.com/adding-columns-to-dashboard-table/ but I'm very new to PHP so it would be great if I get the required codes. Is it possible to separate the post-list on dashboard month or year wise as per created/modified date of the post or at least display another column with date?
September 5, 2013 at 12:49 am 7802
Tareq Hasan Tareq Hasan

You can use the same exact code from there. Just one modification is needed. Instead of showing this following code in the 2nd function:
[php]
if ( $sub = get_post_meta( $post->ID, ‘subhead’, true ) ) {
echo $sub;
} else {
echo ‘—‘;
}
[/php]

Use this following code:
[php]echo get_the_category_list(‘, ‘, ”, $post->ID);[/php]

Whole code (with created date):
[php]function wpufe_dashboard_change_head( $args ) {
printf( ‘<th>%s</th>’, __( ‘Category’, ‘wpuf’ ) );
printf( ‘<th>%s</th>’, __( ‘Created’, ‘wpuf’ ) );
}

add_action( ‘wpuf_dashboard_head_col’, ‘wpufe_dashboard_change_head’ );

function wpufe_dashboard_row_col( $args, $post ) {
?>
<td><?php echo get_the_category_list(‘, ‘, ”, $post->ID); ?></td>
<td><?php echo $post->post_date; ?></td>
<?php
}

add_action( ‘wpuf_dashboard_row_col’, ‘wpufe_dashboard_row_col’, 10, 2 );
[/php]

September 5, 2013 at 4:06 pm 7826
nabharoy nabharoy

Thank you very much Tareq… it’s working fine….

November 8, 2013 at 3:46 am 9845
Marie-Hélène Marie-Hélène

Hi There!
I’ve tried this code to add the category in my dashboard.. but I’m only getting the created date and no category.
Any idea?
Thx

November 8, 2013 at 3:49 am 9846
Marie-Hélène Marie-Hélène

Oh.. I just get it!
Thx

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