How do I call ACF custom field data saved to the widget itself?
I thought perhaps something like this but no dice-
$widget_id = $args['widget_id'];
$myField = get_field('ACF_FIELD_NAME', $widget_id);
Here’s how to do it-
public function widget( $args, $instance ) {
extract( $args );
$widget_id = $args['widget_id'];
$MYVARIABLE = get_field($widget_id.'_ACFFIELDNAME', 'widget');
echo $MYVARIABLE;
...
}
public function form( $instance ) {
$widget_id = $this->id;
...
?>
If you use widgets a lot, consider checking out http://acfwidgets.com
Might speed up your workflow some!
Cheers!