Add-on to Advanced Custom Fields giving you a field to display Widget Areas.
Easily add and change Widget Areas on any page template using Advanced Custom Fields and the Advanced Custom Fields: Widget Area Field plugin. This plugin will add a field with a drop-down selection of all registered Widget Areas in your WordPress installation. You can select which widget area you would like to display in your template files when using ACF’s get_field and the_field functions.
As of version 1.0, support for ACF v5 is included.
Advanced Custom Fields can be found in the WordPress Plugin Repository Here.
This add-on will work with:
This add-on can be treated as both a WP plugin and a theme include.
Edit your functions.php file and add the code below (Make sure the path is correct to include the acf-widget_area.php file. You should also change my_register_fields function name to something unique.)
add_action(‘acf/register_fields’, ‘my_register_fields’);
function my_register_fields() {
include_once(‘acf-widget_area/acf-widget_area.php’);
}
For this plugin to work, you need to have the Advanced Custom Fields Plugin installed. Once installed, you will be able to select a Widget Area as one of your custom fields.
The WordPress Codex has an article on Widgetizing Themes which includes “How to Register a Widget Area”. If you add a new Widget Area (also called sidebar) with this method it will be available in Appearance > Widgets and also able to be selected in your new Widget Area Field.
The Advanced Custom Fields website has documentation on displaying custom field values.