Content
Once you've had time to play around with the different column widths and breakpoints it's time to add content to each column. To do this you'll simply use any of the Gutenburg blocks available within WordPress.
Hopefully by now you have a better understanding of the tools we like to use when building out a WordPress website and the Philosophy behind why we've chosen these tools. If you need a refresher take a look at our Build Philosophy.
This next step is all about putting those tools to use and building out some beautiful pages. Let's jump right in.
Remember the Bootstrap Blocks plugin? If you still need to download it head to the download page or search for it from the plugins page from within WordPress. Install the plugin and ensure it matches up with the version of Bootstrap we're including in our theme files (currently version 5.2).
The Bootstrap Blocks plugin is a lightweight addition that simply adds a few Blocks to the Gutenburg editor. The three main blocks you'll end up using are the Container
, Row
and Column
blocks. That's it. Paired with WordPress's Group
Block, you can achieve just about any layout possible. Let's take a look at a basic example.
Let's say we need to build out a simple 3 column layout. We start by adding our blocks.
HINT: Once we start nesting Groups, Container and Columns onto our page they can become difficult to select (an area that still needs improving with Gutenburg). However, WordPress does offer a small breadcrumb at the bottom of the window that tells you what block is currently selected, and, where that block falls within the page hierarchy. Use this breadcrumb to select the blocks you need.
There will come a time when the default Gutenburg editor blocks can't offer enough flexibility and customization. This is where we can us Advanced Custom Fields PRO.
ACF PRO gives us the ability to quickly build a custom block and add it to the list of available Gutenburg blocks we can add to the page.
It's always easiest to learn from an example, so let's say we need an FAQ accordion.
We already have Bootstrap included so it would make sense to take advantage of their Accordion Component.
ACF PRO also has a Repeater field which allows a user to add and remove a set of fields on the fly.
Lastly, ACF PRO allows us to build out Blocks.
Let's put these all together. We're going to need to setup our Custom Fields within WordPress but first we need to go ahead and create a new ACF Block within the theme. If you look back at our Theme Setup page you'll see the /blocks section. This gives you an overview of a sample block that has already been created for you within the theme. Feel free to modify this block directly or clone it to create a new block. With that in mind you can also utilize the official ACF documentation on Blocks.
Once you have your block configured head over to the WordPress admin and add your custom fields. If we're creating an FAQ accordion block we'll want to use the Repeater field. Inside of the Repeater field we would add a Question Text
field along with an Answer Text Area
field.
At the bottom of the window you'll update the Settings to Show this field group
if Block
, is equal to, the name of your block
. This assigns the custom fields you just created to the custom block you have registered in your theme.
Last updated