WordPress comments for my custom table of records


I need some advice on if I did it right or if I should implement the whole thing differently.

I am writing some custom code for wordpress so the users can add information regarding their dance classes.

For example one user can post that on Friday night had a dance class and upload a photo and write some details.

The records are kept on separate tables which I created already.

The whole system works good (I think) and users can add their classes, update or delete them.

What I am trying to figure out is how can I make it possible for the other users to make comments.

Is there any way to somehow connect the commenting system, the wordpress already has, to my records? Or I should had my records be assigned to a post (each dance class to a different post)?

Can you give any link or info?

I have edited it because the comment could not fit my answer.

Thank you very much for your reply! It took me so long to reply because of my work and I also wanted to try first what you suggested.

I did a couple of tests and everything seems to work almost as I would like to (I followed a nice tutorial about movie reviews).

The one issue I have is that I cannot figure out how I could use relational data (not sure if I said it right..). What I mean is normally I need to have more than one tables where I store several kinds of stuff..

For example I said I followed a tutorial about movie reviews..

In the tutorial it was assumed that each movie will have..

  • Title
  • Director
  • Rating
  • Plot

It seems to be straightforward because in the loop it fetches all the needed data based on the custom post id.

What happens if the movie directors are more than one? How can I have all of them related to the movie?

I was used in working with several tables like that..


Where as you understand you have movies, directors and one tables with foreign keys to link the other two.

One solution so far for the custom posts would be to store in the director field the ids of the directors instead of the director name and query the details separately..

Or is it better to create a different custom post type for movies and a different for directors? And connect them somehow?

Any suggestions?

Link: WordPress comments for my custom table of records
Source: Stack WordPress


About Author

Leave A Reply