display custom data from database to post type in wordpress

admin

Administrator
Staff member
Suppposed to be, I had custom database table in wordpress:
Let us say:
Code:
wp_messages
table with fields:
Code:
from, title, subject, body

something like this:

Code:
_____________________________________________
| from     | title   | subject   | body     |
---------------------------------------------
| JohnDoe  | Test    | Hello     | World    |
---------------------------------------------
| JaneDoe  | Test2   | Hi        | WordPress|
---------------------------------------------

Now, I want to display the data from that table to a custom post type i created:

Code:
function create_post_type() {
  register_post_type( 'messages',
    array(
      'labels' => array(
        'name' => __( 'Messages' ),
        'singular_name' => __( 'Message' )
      ),
      'public' => true,
      'has_archive' => true,
      'menu_position'      => 8
    )
  );
}
add_action( 'init', 'create_post_type' );

Is that possible? Please help me. Thanks!!!