Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am always looking to minimise my reliance on plugins. I currently use Advanced Custom Fields plugin for pretty much every site I build.

I can't help but feel that the functionality this plugin brings should be (and probably is) something the WP supports, i.e. multiple WYSIWYG blocks per template/specific pages.

Could anyone suggest a way of having multiple editable content sections (specifically WYSIWYG) on a page without using plugins?

I am aware of the capability of adding meta boxes for single text fields, etc, but that's not what I am actually after.

share|improve this question
    
Look at the plugin source and see how it does things. –  s_ha_dum Nov 16 '12 at 15:10
1  
What are you after? If you don't want a plugin to add custom fields, you have to do it on your own. You need a couple of functions - one to create the meta box, one to save it's input and I think that's pretty much it. In your meta box you can have whatever you want, including a WYSIWYG field. –  Nikola Ivanov Nikolov Nov 16 '12 at 15:16
1  
Elliot (the ACF dev) is actually releasing a "lite" version of the plugin next week so theme/plugin devs can include it without depending on the ACF plugin. All the goodness, none of the unneeded fluff –  Zach Nov 16 '12 at 15:23
3  
What is inherently wrong with using Plugins? If the Plugin is coded properly, it will be as - if not more - efficient than incorporating the same code directly into your Theme (where custom post meta data generally doesn't belong, anyway). –  Chip Bennett Nov 16 '12 at 17:48
    
Thanks for your responses guys - very helpful. There is nothing inherently wrong with plugins apart from that as a developer I want to be able to make my own plugins customised to each job I take on. This is a fundamental of that objective. Now it has been made clear that using custom fields and meta boxes I can achieve this makes my life a whole lot easier. From the codex I presumed it was just for check boxes or single line text fields. Thanks a bunch. –  JohnC Nov 20 '12 at 10:08
add comment

1 Answer

I am aware of the capability of adding meta boxes for single text fields, etc, but that's not what I am actually after.

Meta fields aren't just for "single text fields", the database type is longtext:

mysql> DESCRIBE wp_postmeta;
+------------+---------------------+------+-----+---------+----------------+
| Field      | Type                | Null | Key | Default | Extra          |
+------------+---------------------+------+-----+---------+----------------+
| meta_id    | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| post_id    | bigint(20) unsigned | NO   | MUL | 0       |                |
| meta_key   | varchar(255)        | YES  | MUL | NULL    |                |
| meta_value | longtext            | YES  |     | NULL    |                |
+------------+---------------------+------+-----+---------+----------------+
4 rows in set (0.08 sec)

This is intentional so you can store just about anything you want in a meta field. When you create your meta box you can use any form input you like as long as you handle it correctly when saving the post.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.