Modular page content in WordPress

I want to build a modular WordPress CMS. By this, I mean that each page starts blank. Then, in the Admin the user would select from a list of modules that they want to put on the page. These modules will essentially be self-contained snippets of HTML that you fill the content in via the admin.

As an example, consider these two modules:

Read More

Module 1

<h2>Title of Module1</h2>
<div>Text</div>
<img src='image.jpg'>

Module 2

<div class='carousel'>
  <img src='one.png' id='carousel-img-1'>
  <img src='two.png' id='carousel-img-2'>
  <img src='three.png' id='carousel-img-3'>
</div>

The user would be able to organize these snippets of HTML in any quantity and order on each page. And in the admin you’d have text boxes that would fill in values for the snippets.

I have two questions:

1) Is it a reasonable project to build a WordPress site that is modular in this way? Reasonable would involve writing Themes, Plugins, and Widgets to accomplish the goal, rather than making major changes to core WordPress code.

2) Are there specific resources online that you know of that could help me with this endeavor? My searches haven’t yielded anything useful to me. Themes that do something like this, or blog posts that touch on the matter would be immensely useful to me.

I’m quite familiar with PHP, so any need to write PHP is completely fine and territory I feel comfortable in.

To reiterate my question:

If building a modular WordPress theme is a feasible goal, what are resources to that could be useful to someone desiring to do such a thing?

(I understand this question isn’t about a very specific programming problem, as many questions on StackOverflow, but I still feel that the answer is one that could be of value to the WordPress community.)

Related posts

Leave a Reply

1 comment

  1. 1) Yes, it is feasible and this is pure Plugin territory. Unless you want to fork WordPress, never touch the core.

    2) If you know PHP, the best approach, IMO, is

    • read the Developer Documentation

    • for this project you’ll need specially the Settings API (search in WPSE and a helper class in GitHub)
      and Custom Meta Boxes (search in WPSE
      and a helper class in GitHub)
      .

    • study other folks plugins.

    • a lot of jQuery (maybe Ajax) to make the modules user interface

    I believe I could replicate almost the exact system that you’re describing with the plugin Advanced Custom Fields and creating a custom ACF add-on to manage some specifics.

    A custom plugin can be built basically with the docs and WPSE Answers. Whenever stuck in something, just search for WP hooks and functions you’re dealing with, and normally articles and Q&A’s will pop up.