I am new to wordpress and would like to get a way forward for a particular problem.

  1. I have a database table A with various columns.
  2. For each record in table A a wordpress page needs to be created in the wordpress database.
  3. The page should be custom designed.
  4. The whole process has to be included in a plugin.
  5. The admin uses the plugin to create pages after database is updated.

Any help would be appreciated.


  • Looks like a whole job description to me. – RRikesh May 29 '13 at 10:26
  • This isn't a question, this is a collection of questions, I see at least 4 here, and they should be asked separately – Tom J Nowell May 29 '13 at 10:33
  • 1: I have a database with a custom table, how do I generate pages in WordPress from the table rows? – Tom J Nowell May 29 '13 at 10:34
  • 2: I have pages i've generated from a table as per Question ABCDlinkgoeshere, I need to apply a custom design to each one, how do I do it? – Tom J Nowell May 29 '13 at 10:34
  • 3: I have this code, how do I create a plugin out of it? ( trivial to do ) – Tom J Nowell May 29 '13 at 10:35

Points 1 and 2:

Use the wpdb class to read the table. Then use wp_insert_post() to create your page.

Point 3:

WordPress has a Template Hierarchy that allows you to define which theme file to use.

Point 4:

Read the article on Writing a Plugin and add your code in it.

Point 5:

Choose a way to mark which was the last item that was processed, You can for example, save the index of the last article you processed assuming the index increments after each new record. You can even automate the job using wp_cron.

| improve this answer | |

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.