-
-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate Widget ID #36
Comments
If you change https://github.com/Log1x/acf-composer/blob/master/src/Providers/AcfComposerServiceProvider.php#L39 to |
Thanks for looking into it. Looks like the result is the same as before with this change: $this->app->bind('AcfComposer', function () {
return $this->compose();
}); |
My guess was something to do with the passed |
man I'm a little stumped on this. it has something to do with the proper variables not passing when initializing the anonymous class. there has to be a way to make it properly work |
So got a hacky 'fix'.. Setting the id from the instance/args seems to fix it? https://github.com/Log1x/acf-composer/blob/master/src/Widget.php#L125 public function widget($args, $instance)
{
+ $this->widget->widget->id = "widget_{$args['widget_id']}";
echo Arr::get($args, 'before_widget'); |
Hey @Log1x thanks for fixing up those other bits, much appreciated. Just run into this weird one today - not sure if it's the way I'm calling
get_field()
maybe? But trying out theExample
widget it appears to have the same issue.Summary
Multiple widgets return the same
widget_id
so ACF data returned is always the last widget added (of the same type).Example
wp acorn acf:widget Example
The text was updated successfully, but these errors were encountered: