Front to Back, take 2, step 07

Putting the ducks in a row.

What do we want? Now! When do we want it? Asynchronicity!

Beside the developer pun the next iteration of the Front to Back plugin will concentrate on decoupling the template generation from the Theme Customizer components initialization.
That coupling did come into play during the exploration phase but it’s not the way things should happen.

The way things happen now

The Front to Back plugin was born out of an unsatisfied need of mine: when facing WordPress theme development in a small and page oriented site context I find myself doing the same operations over and over:

  • plan out the site pages
  • create a 'page-page-name.php template file for each page
  • in a plugin add the needed meta boxes and custom fields controls to each specific page administration screen
  • add some global theme settings in the Theme Customizer

In projects like these the full power of WordPress as a CMS is hardly unleashed and its UI often proves redundant and confusing for first time users.
On the other side the Theme Customizer offers a clean and easy to understand experience that will often lead to questions like “Can I edit the pages here?”.
Sadly no.
But sure the Theme Customizer, the “Theme” part of the name clear in functions to developers only, lends itself all too well to the misunderstanding.
“Front to Back” is an attempt, in these specific situations, to change that answer to “yes”.

How I’d like things to happen

Given the same context above the plugin should allow a flow like this:

  • plan out the site pages
  • create an ftb-templates folder in the theme root folder
  • for each page create a 'page-name.php template file in said folder using, where applicable, the <ftb-* /> tags
  • from the administration screen, on my local WordPress installation, hit the “Generate Templates” button and see:
    • a 'page-page-name.php template file generated for me in the theme root folder
    • the Theme Customizer controls required to customize the page appear when customizing the page
  • have the user customize the theme aesthetics and page contents from the Theme Customizer

Todos

The current version of the plugin will read templates backward and only support the all too clear ftb-title tag.
Missing pieces for a first useful version are:

  • have the Theme Customizer controls added asynchronously once the template reader has generated the WordPress templates
  • content support
  • basic single meta support
  • featured image support

While the plugin owes a big inspiration to the Perch CMS") it makes the template generation possible into WordPress and will not force the exclusive use of an alternate markup in the templates.

Next

I will add the Theme Customizer control configuration creation at template reading time leveraging the Kirki library.