Are Pages the right thing to use for making sections of a single-page site?

I would not recommend using subpages for sections for the following reasons:

  • The section subpages can be deleted, set to draft and many other misuses by mistake.
  • It is difficult to control the user input on them.
  • There is no easy way to deal with booleans or options, such as “show/hide this” or “use design 2 for this section”.
  • When retrieving the page content, there might interferences with plugins altering the_content hook.
  • It is not easy to extend this method to other pages in the same website without messing up the admin’s pages list view with countless subpages.

For the task of building up a section based page, there are so many different methods in the end there is probably not a single correct answer that can cover all the possible cases.

I have had to work with many different solutions for this task, such as:

  • A widgetized homepage sidebar with custom made widgets.
  • A “Sections” custom post type with support for page-attributes to allow custom ordering.
  • Shortcodes for opening and closing sections.
  • A separated options page.
  • Content builders.

But in my experience what turned out to work better in production in those cases where the user is not intended to design but to fill in content were metaboxes, which happenend to be the native tool WordPress provides for custom content in pages. The users find them more intuitive than the content builders and their manipulation is much less error prone than any of the others solutions.

The usage is simple: add one or as many metaboxes as sections you need. Then, in each one, declare as many fields as editable content there will be in that particular section. And finally modify the frontpage.php of the theme or create a custom template that reads and prints those metaboxes contents. Remember to escape them.

If you need some dynamism in your metaboxes, such as reordering, repeater fields, wysiwyg editors, etcetera, have a look at CMB2, a free, mature open source library that allows you to use several fields in a very easy way. You can also opt for Advanced Custom Fields, a plugin with a very extense free functionality and some premium features that differs from CMB2 in offering a fully working frontend.