最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugins - Programmatically generate new pages for a site based on page template and content elements accessed via DB

programmeradmin0浏览0评论

I 'd like to programmatically generate new pages for a site - the textual and visual components of the content are stored in a DB, this includes the names for the different locations the pages are for, links to the location specific images and custom description text.

My first attempt would be to code a template for the page the way I want it to look like with the different sections, elements etc and then retrieve the relevant content for each page from the DB (by using the corresponding reference names for the elements as defined in the template)and send it to wordpress (with a post request to the rest api presumably)

(This is a data analyst's attempt to automate a web development process.)

1) Is the above process feasible and meaningful ? (in theory)

2)Are there any plugins or instructions that would facilitate this (in practice) especially without reinventing the wheel ?

Clarification: The use case is the equivalent of having a list of hotels and locations and corresponding images and content in a DB (I haven't created that yet and it could be anything from an online spreadsheet to some storage service on the cloud - anything that can let me programmatically access the data.) The goal is that then if I want to add say a 100 new locations and create the corresponding pages I can do it instantly

I 'd like to programmatically generate new pages for a site - the textual and visual components of the content are stored in a DB, this includes the names for the different locations the pages are for, links to the location specific images and custom description text.

My first attempt would be to code a template for the page the way I want it to look like with the different sections, elements etc and then retrieve the relevant content for each page from the DB (by using the corresponding reference names for the elements as defined in the template)and send it to wordpress (with a post request to the rest api presumably)

(This is a data analyst's attempt to automate a web development process.)

1) Is the above process feasible and meaningful ? (in theory)

2)Are there any plugins or instructions that would facilitate this (in practice) especially without reinventing the wheel ?

Clarification: The use case is the equivalent of having a list of hotels and locations and corresponding images and content in a DB (I haven't created that yet and it could be anything from an online spreadsheet to some storage service on the cloud - anything that can let me programmatically access the data.) The goal is that then if I want to add say a 100 new locations and create the corresponding pages I can do it instantly

Share Improve this question edited Sep 10, 2019 at 13:10 Alexandros Papageorgiou asked Sep 10, 2019 at 10:29 Alexandros PapageorgiouAlexandros Papageorgiou 11 bronze badge 2
  • Can you provide some context? What problem are you trying to solve by doing this? Is this an initial setup process? You mentioned a database, what is this DB? It's unclear – Tom J Nowell Commented Sep 10, 2019 at 10:59
  • 1 some context added as you suggested @TomJNowell – Alexandros Papageorgiou Commented Sep 10, 2019 at 15:58
Add a comment  | 

1 Answer 1

Reset to default 0

Sounds like you'd just be able to make a custom post type in WordPress, a page template that displays that post type, and then import new content at will.

If you will be importing large datasets and need pages created on the fly, you can probably use an importer plugin for that: http://www.wpallimport/

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论