'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments', 'revisions', 'custom-fields' ),`

This argument should display author column on wordpress dashboard's post table, but it does not in "listing" custom post type in Elegant theme's "Explorable".

Any idea?

Update: I think this part of the code is restricting author from the post table, how could I add author to it:

    add_filter( 'manage_edit-listing_columns', 'et_listing_edit_columns' );
function et_listing_edit_columns( $columns ) {
    $columns = array(
        'cb'                    => '<input type="checkbox" />',
        'title'                 => __( 'Title', 'Explorable' ),
        'et_listing_type'       => __( 'Type', 'Explorable' ),
        'et_listing_location'   => __( 'Location', 'Explorable' ),
    );

    return $columns;
}

add_action( 'manage_posts_custom_column', 'et_listing_custom_columns' );
function et_listing_custom_columns( $column ) {
    $custom_fields = get_post_custom();

    switch ( $column ) {
        case 'et_listing_type' :
            $et_listing_types = get_the_terms( get_the_ID(), 'listing_type' );

            if ( !empty( $et_listing_types ) ) {
                $out = array();
                foreach ( $et_listing_types as $et_listing_type ) {
                    $out[] = sprintf( '<a href="%s">%s</a>',
                        esc_url( add_query_arg( array( 'post_type' => 'listing', 'listing_type' => $et_listing_type->slug ), 'edit.php' ) ),
                        esc_html( sanitize_term_field( 'name', $et_listing_type->name, $et_listing_type->term_id, 'listing_type', 'display' ) )
                    );
                }

                echo join( ', ', $out );
            } else {
                _e( 'None', 'Explorable' );
            }

            break;
        case 'et_listing_location' :

            $et_listing_locations = get_the_terms( get_the_ID(), 'listing_location' );

            if ( !empty( $et_listing_locations ) ) {
                $out = array();
                foreach ( $et_listing_locations as $et_listing_location ) {
                    $out[] = sprintf( '<a href="%s">%s</a>',
                        esc_url( add_query_arg( array( 'post_type' => 'listing', 'listing_location' => $et_listing_location->slug ), 'edit.php' ) ),
                        esc_html( sanitize_term_field( 'name', $et_listing_location->name, $et_listing_location->term_id, 'listing_location', 'display' ) )
                    );
                }

                echo join( ', ', $out );
            } else {
                _e( 'None', 'Explorable' );
            }

            break;
    }
}
  • Check if it's not hidden by default within the Screen Options pane in the top right corner of the screen. – Wacław Jacek Jan 19 at 16:04
  • Checked, Author is not an option on the selection list, only two associate taxonomy: type and location. – Mizan Jan 19 at 16:08
  • 1
    Can you please post the part of code in which you're calling register_post_type()? – Wacław Jacek Jan 19 at 16:19
  • updated the post for clarification. – Mizan Jan 19 at 17:09
  • By default Author is a valid column, but your et_listing_edit_columns() function removes all columns and replaces them with 4 custom ones. – swissspidy Jan 19 at 17:38

Instead of changing all the columns just add and remove the columns that you want.

add_filter( 'manage_edit-listing_columns', 'et_listing_edit_columns' );
function et_listing_edit_columns( $columns ) {

    $columns['et_listing_type'] = __( 'Type', 'Explorable' );
    $columns['et_listing_location'] = __( 'Location', 'Explorable' );

    // You can remove columns with unset()
    return $columns;
}

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.