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
- 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?
- 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
- Difference and examples of esc_attr__() and esc_attr_e()
- Sidebar widget: Randomly select text from a given set
- How do I use add_action on custom widget?
- How to prevent additional code in functions.php to be removed once there is an update?
- Exclude posts from widget while post is showing on home, single and categories
- Woocommerce singe product custom gallery output works just on the first slide
- Why is it so hard to add a class to the tag in the sidebar widget?
- How to translate wordpress error message
- Need to setup grid like thumbnail of recent posts on sidebar
- More gentle way to hook WordPress custom url
- Removing the custom_image_header from wp_head
- Build a must-use plugin that tracks when other plugins are activated or deactivated
- Unable to locate inline CSS causing parts of page to be blank
- Checkbox show / hide output result
- How to keep plugin (media-sync) running even the tab is closed?
- Load CSS before Theme CSS
- Elementor pro page editing gives error There has been a critical error on this website. Please check your site admin email inbox for instructions
- Attempting to list all product categories and the price range of all products within them
- the_posts_pagination() not working if I add wp_head() to header.php
- FPDF for creating pdf diplomas
- Creating an array from form inputs before it is posted to the options database
- adding dynamic/multiple slug values in ‘option_none_value’
- How to assign a specific service to a specific provider based on location
- Conditional Homepage for logged in user
- Compare Ajax Data Results
- EventON – Dequeue Styles
- How can I make the search bar in my wordpress site search all of the pages rather than just the blog posts?
- Nested DIV’s across functions in PHP, do not seem to work
- WordPress Add advertising ads befor and after content with periority [closed]
- Function in my plugin is called twice
- Searched & tried a lot: Is it Possible to Eliminate Render Blocking Manually
- Every time I use wp_get_current_user() my plugin breaks
- Can plugin automatically update if i hide the update notification?
- AJAX login without a plugin does not work. when add a action to function.php
- Programmatically retrieve the sidebar/s classes
- How know the “admin” blog from wordpress multisite?
- Saving plugin data returns “You do not have sufficient permissions to access this page.”
- How to use scripts when header/footer are stripped out
- How to add a handler for a button in plugin?
- Call current post parameters inside a plugin
- How to list posts that appear in two categories
- pre-upload text and video for the future
- Last article Widget with text preview and more button
- Building custom pages with a video player
- Move related products after product summary? [closed]
- Adminimize Plugin — Is there an alternative to limiting Editor to ‘Appearance > Widgets’ only?
- Woocommerce – Product Description heading [closed]
- Woocommerce disable checkout on specific day
- Sidebar Slideshow widget with text [closed]
- Gravity Forms and Gravity View Permissions
- Run a function only once when logging into dashboard
- How to call a logging function from a generic utility plugin from another plguin