0

I have a basic custom post type:

function create_posttype() {
    register_post_type('guestbook',
        array(
            'labels' => array(
                'name' => __('Guestbook Entries'),
                'singular_name' => __('Guestbook Entry')
            ),
            'menu_icon'           => 'dashicons-book',
            'public' => true,
            'has_archive' => true,
            'rewrite' => array('slug' => 'guestbook'),
            'show_in_rest' => true,
        )
    );
}
add_action( 'init', 'create_posttype' );

When I view my custom post type on the back end I see columns for Title and Date, but I'd also like to include a column for the content, I have something pretty close:

function reorder_guestbook_columns( $columns ) {

$columns = array(
    'title' => __( 'Name' ),  // Post Title
    'content' => __( 'Message'), // not populated!
    'date' => __('Date'), // Published Date
);

  return $columns;
}

add_filter( 'manage_guestbook_posts_columns', 'reorder_guestbook_columns' );

This works, now I have three columns, but nothing shows up in the message column. I know I don't have the_content() added anywhere, but I don't know where I need to put that to make this code work!

Is this even the right approach?

I feel like I'm close, I just need someone to point me in the right direction :-)

Thanks!
Josh

1

0

Your Answer

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

Browse other questions tagged or ask your own question.