How to create a page template that retrieves content from db?

I have to create a hundred of content pages that share the same structure.

For example:

[Title] - [Subtitle]

[Description]

[Specs]

 - [Spec-A]
 - [Spec-B]
 - [Spec-C]

[Features]

 - [Image-A][Feature-A]
 - [Image-A][Feature-B]
 - [Image-A][Feature-C]

I would like to store this information in some DB tables so that if I need to change the template content positions or style, I can do it once for all pages.

But unfortunately I am not very good at PHP, so I don’t know where to start. Which features of WordPress or plugins can I use to reach the result?

Thank you in advance

3 Answers
3

You might want to consider creating a Custom Post Type for this product (I assume it’s some sort of product), and then adding custom metaboxes, that will store the custom data (specs, features, etc.) as metadata for each Post.

Then, your custom template file becomes “single-.php” (e.g. “single-product.php”), and you can structure the markup however you need.

Storing the custom data (specs, features, etc.) as post metadata allows you to retrieve these data using get_post_meta() (Codex ref) or get_post_custom() (Codex ref).

Leave a Comment