0

everything good?
I need the wp-list-table to also show custom-fields in each custom-post i have, and I do not know how to do that,
In this image it shows the table with the fields: Title, Author and Publication Date:

enter image description here

What I want is to be able to choose which custom-fields will appear, such as the following example, being Title, Carta, Naipe, Author, and Date of Publication:

enter image description here

0

Solved Situation:

 // Add the custom columns to the copas post type:
    add_filter( 'manage_copas_posts_columns', 'set_custom_edit_copas_columns' );
    function set_custom_edit_copas_columns($columns) {
        //unset( $columns['author'] );
      $columns['coluna_carta'] = __( 'Carta', 'your_text_domain' );
      $columns['coluna_naipe'] = __( 'Naipe', 'your_text_domain' );
      $columns['coluna_situacao'] = __( 'Situacao', 'your_text_domain' );
      return $columns;
    }

    add_action( 'manage_copas_posts_custom_column' , 'custom_copas_column', 10, 2 );
    function custom_copas_column( $column, $post_id ) {
      switch ( $column ) {
        case 'coluna_carta' :
        echo get_post_meta( $post_id , 'dbt_carta' , true ); 
        break;

        case 'coluna_naipe' :
        echo get_post_meta( $post_id , 'dbt_naipe' , true ); 
        break;

        case 'coluna_situacao' :
        echo get_post_meta( $post_id , 'dbt_situacao' , true ); 
        break;

      }
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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