TransWikia.com

Automatically generate pages from SQL

WordPress Development Asked by trilobutt on November 26, 2021

I’m building a biodiversity database and am looking for the easiest way to display all the information online. I know I can do this without a CMS, but I have too tight a deadline to waste time designing something fancy from scratch (easier to slap a quick theme).

I’m struggling between choosing WordPress (experience in it) and Drupal (it will definitely work, but much more time-consuming to make it look nice). I’d love to choose WordPress, but I’m wondering if it can handle the main aspect.

Namely, can I automatically generate pages for every row in my main SQL table? Say I have a table with this structure:

ID | Rank | Parent | Name

This table will have 6000+ rows, and each Name must have its own dynamically-generated page. Populating each page is simple with custom templates which I already have.

My problem is having to manually make 6000+ pages, one for every name, and then making new ones every time a new species is added. Is there some function or plugin that will generate pages dynamically, with the custom template, and even with a nice permalink?

I can do this in Drupal, but don’t know how I can do it in WordPress.

One Answer

Use a shell script and WP-CLI in your SSH console. Your shell script has to fetch each element of your table and launch the function of WP-CLI that creates a post in Wordpress. You can even provide a sort of template in the call of the function. WP-CLI is a useful tool, but you can also do it your own way by using Wordpress cli scripts (see documentation).

Answered by RMS on November 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP