Notice: This thread is over two years old; the information may be outdated. Please consider creating a new thread if you require free support. If you have an active SiteOrigin Premium license, you can email our premium support desk at [email protected].
Thanks for making this plugin free and for using widgets.
I would like to pre-populate a select form with a WP_Query data(eg Post Title). I do not know how to go about it. This is what I have:
'some_selection' => array( 'type' => 'select', 'label' => __( 'Choose a thing from a long list of things', 'widget-form-fields-text-domain' ), 'default' => 'the_other_thing', 'options' => '' " )
The widget shows up in the widget area but, of course, its empty because I do not know what to put in the “options” value above.
I want to add that generating post title is not the problem but how to pre-populate the select field with it.
Thanks
Hi Davexpression
Thanks for your support. Please, find our developer docs for Page BUilder and the Widgets Bundle here:
https://siteorigin.com/docs/page-builder/
https://siteorigin.com/docs/widgets-bundle/
Both plugins are on GitHub so if you’d ever like to get involved in development, they are there.
The documentation page you’ve been working with is here: https://siteorigin.com/docs/widgets-bundle/form-building/form-fields/.
I’m perhaps losing you in the last part of your question. The options array should contain the options you’d like to display in your drop down field. Did I perhaps mis-understand when you said:
I do not know what to put in the “options” value above.
Thanks for your quick reply. Sorry for not being very clear.
In my theme, I have a folder called “so-widgets” and inside it I have two widget folders following the tutorial you mentioned above. One of the folders is called “sermon-widget”.
The problem is that I have a function called “term_options” that uses get_term to load terms of a taxonomy registered by a plugin. In my sermon-widget.php, I have this:
Nothing happens. After some diggings, I found that the taxonomy above is registered with init hook with priority of 10 (default). So, I opened so-widgets-bundle/…widget-manager.class.php and changed
to
and surprisingly, it worked – “term_options” loaded the terms of the plugin’s taxonomy. I know that widgets_init, according to Codex, is same as init (1). Also, changing to init with a priority of 11 worked as well.
However, I created a new simple widget – the normal way – in my theme folder and registered it with widgets_init hook. I found that “term_options” worked as well. Maybe it’s because my simple widget is inside my theme folder.
BIG QUESTION: Can I output the terms of a taxonomy registered by a Plugin in my custom widget? If yes, pls how?
Pls, I am not so much of a developer, any assistance is well appreciated. I really want to create an SO widget. Thanks
Thanks for explaining further, much appreciated. I’ll pass this onto our development team and see if they can assist early next week. Thanks for the wait.
Thank you so much.
Sent from Samsung Mobile
Thanks for the wait. If you’re still working on this, one of our developers Braam has the following to add:
An associative array should work there, for example:
As long as it’s in that form it should be fine.
If it’s coming up as empty you should check to make sure the result of the function in question isn’t empty.
(Our dev level support is really light at the moment so hopefully this helps get you going :) )