Home › Forums › General Issues › Shortcode not working in Widget › Reply To: Shortcode not working in Widget
In order to get custom fields for widgets using a shortcode you’d need to specify the correct post id. In this case is would be something like widget_' . $widget_id)
, so you’d need to include the id in the shortcode.
See the shortcodes doc here http://www.advancedcustomfields.com/resources/shortcode/ and document on getting values from fields attached to shortcodes here http://www.advancedcustomfields.com/resources/get-values-widget/.
I don’t know how you’d know what the actual ID of the widget it when editing the widget and this is only a guess. If I save the widget and then inspect the code it has an id that looks something like this widget-14
. I suspect, but would have to test, that the ID value of the widget that I’d need to use for ACF is 14
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.