No parent necessary: the difference between a not-working widget and a working widget was this:
$text1 = apply_filters( 'widget_text1', $instance['text1'], $instance );
vs:
$text1 = apply_filters( 'widget_text1', empty($instance['text1']) ? '' : $instance['text1'], $instance, $this->id_base);
I realized putting multiple Random Text widgets on the same page, their titles worked, but their text content did not. So I copied the properties (empty($instance…etc.) from the title to each of the text instances.
The widgets themselves were instantiated, but the text areas weren’t. At least, that’s what I think was happening. I don’t know enough PHP to know for sure.
If anybody has insight as to why the second version works and the first doesn’t, I’d be happy to hear it. 🙂
Related Posts:
- Missing argument 3 for wp_register_sidebar_widget()
- Cannot access variables within a widget
- Between functions.php (theme), widgets, and plugins, which is loaded first?
- How To Determine If A Filter Is Called In A Sidebar/Widget Context?
- Need to create a Theme demo site that features multiple themes
- Adding a widget programmatically
- Override dynamic_sidebar() in plugin?
- Custom Widget outputs the input but doesn’t save anything inside the textarea
- Flickr plugin that will display photos from multiple group pools? [closed]
- I need some direction on how to have a sidebar based on meta rather than page
- Multisite Widget/Content
- How to display custom sidebar in wordpress 5.5.2
- Best practice for including plugin output in a template without using shortcode?
- Widget’s container?
- strange shortcode error: does shortcodes requires any dependency?
- All custom widgets are not showing in widget area at the same time
- My widget won’t update its values when save is clicked
- Widget content turns up before title
- Listing all sidebars
- RSS Feed on WordPress showing code (hypertext) in articles titles
- Co-author plus: list of posts by authors in the sidebar
- twitter widget loads properly in all themes except my own theme?
- Template from scratch: Sidebars not showing widget
- What method should I use for a sidebar widget that reads latest posts?
- Trying to output a “Most visited blogs” list in wordpress multisite
- Can’t edit Contact Us form on front page
- Is it possible to control content on different pages by checkboxing wich content is shown where on a wordpress theme page?
- Disable plugin / plugin action via theme
- Plugin upgrading: Widget settings
- Why does including a file in theme’s functions.php not work?
- How to place random widgets in the WordPress sidebar?
- Adding New Role
- Add Top-Level Menu that opens URL
- wordpress custom login successful redirect hook
- WordPress ajax call for not logged in users, doesn’t work
- Display All Non-Used Plugins
- New Plugin: Post update pushes a copy as a revision
- Placement of Code in Plugin for hooking `save_post`
- How to show my sidebar in specific page only?
- Avoiding Duplicate function names in Post Loop (WP_Footer script)
- How to add class in plugin only for network site?
- PHP Fatal error: Call to undefined function plugin_basename
- Executing my function once on a specific time
- Missing Argument
- load_plugin_textdomain error
- Adding Shortcode to Text Widget
- Does WordPress validate inputs to all functions? (such as get_user_meta and insert_user_meta)
- How to use a class from another plugin
- Widgets Scripts don’t load – but load when I reload the page
- How to remove custom post type and add category and post name
- Custom plugin appears outside of the sidebar container
- Ajax : Call undefined function plugin_function() … can’t call any plugin function
- bbPress plugin: forum lists not showing in correct order? [closed]
- How do I find out what is in control over a certain part of a website?
- Is there a best practice remediation for PhpStorm’s warning that void function the_post_thumbnail is used?
- How to over-ride a file in a plugin? [closed]
- Overwrite category head title
- execute function after one completed
- Custom widget doesn’t save values from dropdown box
- Register Script in Plugin Widget
- How to reset the plugins without deactivate the plugin
- plugins_url() works everywhere but wp_reqister_script()
- Replacing global wp_query
- How to get specific string/value from an array? php [closed]
- WordPress Stock Update Programatically
- 5 PHP Fatal error: Uncaught ArgumentCountError (Cannot Find)
- jQuery Click event is not fired at all
- Getting a ressource ID, from a WC_Order_Item_Product/Order
- get_term_meta returns false in widget
- same user role or copy the user role to be same as the other role
- How to Use the Filter “sidebar_login_widget_form_args”
- How can i listing current category and Featured Category post list?
- How to add custom function to pluggable.php
- grab or load text on demand
- sliding/fading header plugin or approach suggestion
- How would I get the new plugin version on this function?
- How to fetch WordPress database values in JavaScript widget
- Search in WordPress
- What is the right way to populate a dropdown from MySql?
- Modify function output in a plugin
- Is admin section completely customizable in terms of styling?
- How to make the first letter of a post title uppercase, in a plugin?
- Migrating custom php we wrote from functions.php into a site-specific plugin
- Widget outputs the value but doesn’t save anything inside the textarea
- WordPress Widget: Is it possible to make the form dynamic without updating?
- How can the searchform.php know if it’s used on a registered sidebar id ‘sidebar-1’ or ‘sidebar-2’?
- Code fails in plugin file but works in functions.php
- Conditional required fields for WordPress Contact Form 7
- Show widget location borders for development
- adding image in the header of my dev widget
- WordPress plugin options need to delete after deactivate & uninstall
- WordPress function to add text
- Doing action based on input from options menu
- Add the title of a widget as an ID – for anchor links
- What are the downsides of using bootstrap in plugin development?
- Sync roles across several plugins
- How to Allow Users to Select Recipients In a WordPress Comment section?
- Product customizing quiz – quiz adding products to the cart
- Event Made Easy – Block registration to two or more events that have the same category
- I want to allow certain file types on dokan upload files