Home Forums Plugin Support WP User Frontend Pro Add category column

This topic is: resolved

This topic contains 4 replies, has 3 voices, and was last updated by  Marie-Hélène 5 years, 4 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #7764

    nabharoy
    Participant
    Post count: 1

    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?

    #7802

    Tareq Hasan
    Keymaster
    Post count: 2831

    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]

    #7826

    nabharoy
    Participant
    Post count: 1

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

    #9845

    Marie-Hélène
    Participant
    Post count: 15

    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

    #9846

    Marie-Hélène
    Participant
    Post count: 15

    Oh.. I just get it!
    Thx

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

The topic ‘Add category column’ is closed to new replies.