My latest project involved ACF (advanced custom fields) and a lot of it. As I have said in almost every other blog post, I never know what to expect when starting a project. I hardly know what to expect when I’m half way through the project. Thankfully, it turned out to be (somewhat) straight-forward, and I got to use ACF a ton. I used it everywhere. Footers, header, sub menus. It all used ACF. I had no idea how useful ACF was. I guess the issue is that it’s not super useful until you purchase the PRO version.
What Is ACF?
The great thing about ACF is that it helped me separate all the content from the code. Separating the content from the code makes it easier for me to add content, and it makes it easier for anyone else to add content too. Another reason I never used ACF was because I was afraid the content of the site would no longer be portable or migrate-able like sites built with page builders. I was wrong about that though. There are some very good export tools for content in ACF fields.
Using Advanced Custom Fields and Custom Post Types
At first, I wasn’t too sure how to go about using ACF to create the website. I noticed that there was a lot of repeated code. Repeated code always rings a bell. So, I began DRYing up the website in every where I could. I ended up making very good use of the Flexible Content fields. In fact, I probably went overboard. Flexible Content lets you create nice little modules of code, and you get to decide in what order they should show. I also created a custom post type called Modules to hold any content that would display in multiple places, like footer widgets.
The WordPress Way
I started out with mainly PHP files in a WordPress installation. Everything was hard coded, and nothing was set up using the WordPress way. I guess that isn’t super important, but I went ahead and implemented the WordPress way. Originally, I was just going to implement ACF into everything, but I ended up adding the functionality to the website too. I got to make a blog page template, implement a few contact forms using Contact Form 7, and add a few popup forms using the plugin called Popup Maker.
All in all, this project turned out great.