Pergunta

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

Foi útil?

Solução

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).

Outras dicas

Some plugins that will help you, I reviewed some custom post type/meta box plugins a while back and I consider these very solid:

Custom Post Type UI http://wordpress.org/extend/plugins/custom-post-type-ui/

Pods CMS (php knowledge required) http://wordpress.org/extend/plugins/pods/

Custom Field Template http://wordpress.org/extend/plugins/custom-field-template/

Multiple content blocks http://wordpress.org/extend/plugins/multiple-content-blocks/

WordPress Reusables http://wordpress.org/extend/plugins/reusables/

I am a huge fan of More Types, More Fields, and More Taxonomies. I had to do the exact thing you're looking to do, and quickly. I was able to create custom pages and posts without compromising the defaults. Once I created the custom types I then created custom page/post templates (page-documents.php) and pulled the information into them with something similar to this. <?php echo get_post_meta($post->ID, "document-description", true); ?>

enter image description here

Licenciado em: CC-BY-SA com atribuição
Não afiliado a wordpress.stackexchange
scroll top