Forums

How to generate dynamic pages from a database (2 posts)

  1. GaryReggae
    Member
    Posted 4 months ago #

    This is possibly a bit of a 'newbie' post, as I am new to WordPress, but I can't find much info about this from a search.

    One of the things I want to use my new WP site for is a site about pubs in my local area. There are over 200 of these and, while I could create a page for each pub individually, I can see a lot of benefits of having all the data in a database table and then generating the page from that. The best analogy I can think of for this is Microsoft Access, where a custom form or report for each record can be generated from a table into a 'template' with placeholders for the various fields. Even better would be the ability to display a photo of each pub on this page.

    Is there a way of doing this in WP? Ideally using a plugin or something as I don't have any experience of coding other than basic HTML.

    If that's a non-runner then what is the best way of going about creating the individual pages? It's important that they have a consistent design and layout so some kind of template would be useful but I can't see how to create templates, only to apply existing ones.

    Thanks in advance for any advice and sorry if this is a bit of a Noob question.

  2. vtxyzzy
    Member
    Posted 4 months ago #

    The simplest way I can think of to do this would be to use Custom Fields, but this will require a bit of coding.

    Basically, you would assign CF's to posts with details about each pub. For example, you might have CF's with keys of 'pub_name', 'pub_desc', 'pub_logo', 'pub_addr_1', 'pub_addr_2', etc.

    Then you would create a template to display the pub posts.

    You might want to use a Custom Post type to keep the pub records separate from all others.

Reply

You must log in to post.

About this Topic