Using Advanced Custom Fields and Beaver Tunnels to build re-usable templates
If you publish information on your website that requires additional metadata over and above the standard post content, title and featured image, then you might consider creating custom posts types, custom fields and templates for your site.
The standard WordPress post editor has placeholders for the post title, content and featured image. But what if you need to add consistent data to your posts? For instance, you may have a property sales website, and you’d like to create additional fields in your post editor to add the property address, images, sale amount, etc.
You can achieve this by using a combination of Beaver Builder, Custom Post Type UI, Advanced Custom Fields and Beaver Tunnels.
In your Beaver Builder admin, head over to Custom Post Type UI and create a new post type for Properties.
In Advanced Custom Fields, create the fields you require for your new post type and make sure to set your location rules to enable the fields to show up on your new post type editor.
Once you have your post type and fields set up, create a template in Beaver Builder with your ACF field shortcodes positioned in the desired locations. Basic ACF Shortcodes are fine for text fields and other simple entries but if you’re working with repeater fields and more complex relationships then you may need to use ACF code snippets to display these. ACF has PHP code snippet examples to help you with this, and you can also create your own plugin to enable this functionality. Use the PHP Code plugin to achieve this.
Once your template is set up, use Beaver Tunnels to display it on your site. Navigate to the front end of your site and click on the Beaver Tunnel hook guide to choose a suitable area for displaying your template.
If you’d like to see all of this in action, Robert Turner has a great video on his YouTube Channel.
Leave a Comment