Home Forums Plugin Support WP User Frontend Pro Adding taxonomy to dashboard

This topic is: not resolved

This topic contains 2 replies, has 2 voices, and was last updated by  Sekander Badsha 4 years, 7 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #28225

    Donald
    Member
    Post count: 14

    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!

    #28227

    Donald
    Member
    Post count: 14

    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

    #28519

    Sekander Badsha
    Member
    Post count: 2067

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

The topic ‘Adding taxonomy to dashboard’ is closed to new replies.