I wanted to share how I (as a professional full-time Backend developer) still build WordPress Websites on the side. I used to have my own agency, so I have developed (probably) over 100 custom WordPress projects from scratch the last 8 years.
Mind you, this workflow is fully tailored to people having an at least decent understanding of PHP, else it will be hard to follow I’m afraid.
This is my own opinion, and is a workflow I have found to work for myself. I don’t want to force this onto anybody, but feel free to take parts of it, and try them out / incorporate them in your own WordPress development flow!
**Philosophy**
I like to see WordPress as any other framework I have worked with, just a bunch of pre-written open source PHP-code I can use. The fact I am a developer (it’s a bit in our nature I feel like haha), makes it so I try to use as little plugins as possible. This makes it you almost only have the WordPress core to deal with with when dealing with updates / security threats, … giving you a lot less headaches delivering and maintaining a lot of projects.
My goal with developing this workflow is to stay as close to WordPress way as much as possible (if this makes sense?. That’s the reason I personally opt not to use any of roots.io their bundles / packages don’t get me wrong, a lot of work have gotten into them, but, tor me personally they are drifting too far from how I like to develop in WordPress. Opening my projects up to possible compatibility issues, not giving me (or the customer) the flexibility of using every plugin, not being able for my customer to move the project to another agency / developer if they want, … are all personal reasons I don’t use them.
This is just my opinion though, and I could be completely wrong here!
**Goal**
The goal would be to be able to deliver **any backend-complex** project in WordPress. This way, I can quickly develop SaaS MVP’s, Large corporate websites, SMB websites, my own internal tools, …
**Allright, so let’s get on with it!**
Firstly, I previously mentioned I don’t use a lot of plugins, but I still do. It’s never my first choice, but still using (decent, preferably open source) plugins makes it so I can deliver high quality websites a lot faster. This is the power of WordPress we like to leverage as much as possible.
List of plugins:
* Timber (this is the bread and butter of my theme development)
* All-in-One WP Migration (Pro)
* Torro forms (this one isn’t maintained, but does the job really well. Buy, any forms plugin would do. I like Torro because it’s highly extendible and open source).
* Pods – Custom Content Types and Fields
* A caching plugin (of your choosing)
* Docket caching (extra PHP caching just in general). Highly recommend this one!
* A SMTP / E-mail log plugin (of your choosing)
## The preparation
1. I always develop locally in Local by Flywheel. It’s just easy to spin up and maintain several projects. So, I start a new project there. If I need to deploy it, I use (All in1 WMP)
2. I create a new (blank) theme (usually I just copy these over from a previous project):
1. composer.json (which always has the timber/timber dependency, and vlucas/phpdotenv)
2. the functions.php (which has Timber bootstrapped, my tailwind.css file linked, and some helper methods that are generally usefull)
3. package.json (which has tailwind, any custom JS I need, …)
3. Then I create the following folders in the root of my theme:
* src
* blocks (any repeatable twig blocks, this can be Elementor blocks, ACF blocks, …)
* blocks.php
* controllers (if I have to create custom routes that will only be managed by the theme’s PHP code. This could also contain custom API endpoints)
* controllerInterface.php
* controllers.php
* forms (All the custom form handling is in here)
* forms.php
* models (These files are a wrapper around the Timber\\Post for my CPT’s, with their properties, getters and setters defined, …). This makes it a lot more enjoyable to work with in PHP)
* services
* abstractService.php
* shortcodes (Any shortcodes I would create / need)
* shortcodes.php
* templates (all the twig files)
* index.twig
* ….twig
Next up I set auto wiring up under my project’s namespace in this src folder. This makes it all feel quite modern, and up to standards.
1. Then I only create an index.php, that will load in my index.twig, and I am good to go:
​
<header class=”header” >
{% block header %}
{{ function(‘get_header’) }}
{% endblock %}
</header>
<body class=”{{body_class}}”>
<a class=”skip-link screen-reader-text” href=”#content”>{{ _e( ‘Skip to content’) }}</a>
<section id=”content” role=”main” class=”content-wrapper”>
<section class=”mx-auto py-10″>
{% block content %}
{{ function(‘get_content’) }}
{% endblock %}
</section>
{% if sidebar %}
<aside class=”layout-sidebar”>
{{sidebar}}
</aside>
{% endif %}
</section>
{% block footer %}
{{ function(‘get_footer’) }}
{% endblock %}
</body>
</html>
It’s taking me quite a long time to write all this up. Is this something you guys are interested in in further reading about? If so, let me know in the comments below, and I’ll continue writing up my process!
Thanks!
I do not have a ton of experience but I have a similar mindset. I feel that people spend so much time developing and learning all these tools but they could be faster/more effective if they wrote more of their own code from scratch. I use a custom docker environment that I built and keep it minimal. Right now I’m having so many issues dealing with page builder conflicts it’s so frustrating. I hate that shit lol.