Importing a CSV file into Wordpress with Advanced Custom Fields and Applying a BeaverBuilder Template
This weekend, I had a very specific challenge: I needed to create a Wordpress site from a CSV file, and apply a BeaverBuilder template to each of the pages.
While BeaverBuilder is a great plugin, there are some frustrating limitations. If you change a page template design, it does not update previous pages using that template — it only affects future pages. You can go back to older pages and update the template manually, but that’s a tedious process that takes hours when you have hundreds of pages.
I needed a solution that allowed me to retroactively apply template changes to hundreds of pages that I’m creating from a CSV. There weren’t any articles on the internet about this challenge, so I’m writing this one.
Here are the tools I used:
Advanced Custom Fields: this allowed me to create fields in the database that matched the fields in the CSV file.
Ultimate CSV Importer: this let me import the CSV and match up the custom fields in the database to the fields in the CSV.
BeaverBuilderis a page builder plugin that let me create a drag and drop template.
Here’s how I did it:
- I created a BeaverBuilder template that referenced my custom fields using plugin shortcodes (e.g.
- I created a new Wordpress template file that contained the following code in the header:
Template Name: School Page
Template Post Type: post, page*/get_header();
'post_type' => 'fl-builder-template',
'p' => 738,
This is telling Wordpress to call a specific BeaverBuilder template by ID number. All BeaverBuilder templates have a post_type of
fl_builder_template and you can get the post ID from the template URL in the Wordpress admin.
3. I added a field to the CSV called
template and populated it to match the file name of the Wordpress template that I just created (e.g.
4. I used Ultimate CSV Importer to create individual pages, copy over the fields from the CSV to the Wordpress database, and set the right template automatically.
Now, when I make changes to the BeaverBuilder template, it propogates right away without having to “reset” the template in the BeaverBuilder admin. I just have to make sure that the proper Wordpress template is set up on the regular Edit page.