0

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

something like this:

_____________________________________________
| 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:

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!!!

Codeblooded Saiyan
  • 1,457
  • 4
  • 28
  • 54

2 Answers2

0

I think this is what you're looking for https://wptheming.com/2010/08/custom-metabox-for-post-type/

Charbel
  • 1
  • 1
  • Welcome to Stack Overflow and thanks for the answer. Would it be possible for you to quote some of the information in the external link? This enriches your answer by providing context, and also lets the person asking the question know why the link is there. Lastly, quoting the most relevant parts of the link will help persist the answer in case the external site ever goes down. – Troy Witthoeft Aug 13 '17 at 16:39
  • I don't think so. What I want is to query the data from wp_messages table and then display it to a custom post type – Codeblooded Saiyan Aug 14 '17 at 01:07
-1

There's now a commercial plugin called DB Post Types that claims to do exactly that. Citing the website:

Easily use database tables created by other plugins or an external source, as native WordPress Post Types with no data duplication or synchronization.

I have never used it, but the screenshots look promising.

swissspidy
  • 134
  • 9
  • Curious to know why this got a downvote. As far as I understand the question, this plugin would solve this problem. I'd love to show some code instead that would do the same, but as it's such a complex problem, it's impossible to fully cover that here. – swissspidy Jan 19 '18 at 15:00
  • I think your comment addresses exactly why it probably got that down vote. I personally don't mind the links to plugins that do the job that I'm looking for, but StackOverflow I feel is more about posting code and custom solutions. – Brent Mar 22 '18 at 15:53