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?
- Elementor: Exclude product categories when using “Source: Current Query”
- How to add custom function to pluggable.php
- Displaying number of drafts in Posts section of admin sidebar [closed]
- Adding a pagenavi to function for displaying bookmarks
- grab or load text on demand
- Setting text widget to one page only
- How to add captcha to publish widget
- Modify pages widget and make a plugin?
- Can you echo PHP code from a variable?
- Removing the custom_image_header from wp_head
- How do I create pages within a WordPress post?
- wp_footer hook running twice
- jQuery slider widget similar to cnet.com
- sliding/fading header plugin or approach suggestion
- Why aren’t my Follow Me links working?
- What is the most efficient way of adding additional functionaliy for admin only
- Is there any plugin to show number of clicks on the link?
- Defining the value of a variable before a function?
- auto activate plugin when theme is active
- Elementor Pro display featured image on section -> style -> image using shortcode
- How to get custom minimum price in Woocommerce
- Error Metabox Warning: call_user_func() expects parameter 1 to be a valid callback
- Creating New Dynamic Fields for a Certificate (Number Generation, Code Referencing, and more)
- How can i call a functions.php function, from inside my plugin class?
- 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
- Dynamic URL Rewrite for Custom
- Table of contents (TOC) plugin is not showing header tag
- How to make WooCommerce payment method field optional?
- Checkbox show / hide output result
- Replace the_content with ACF Flexible Content via function
- co-authors plugin – inline listing
- How to keep plugin (media-sync) running even the tab is closed?
- Load CSS before Theme CSS
- Custom Logo Link WordPress
- Where do I put the code snippets I found here or somewhere else on the web?
- How to convert Currency from USD to other IP Based currency in Php function
- Widgets are not displaying in the admin panel
- Create a pdf from the entries in DB
- How to upload large media file in chunks, without any plugin?
- how to validate input field in wordpress generated with wpform plugin
- How would I get the new plugin version on this function?
- RSS feeds for specific topics
- Elementor pro page editing gives error There has been a critical error on this website. Please check your site admin email inbox for instructions
- How can I display selected content from a seperate database in an Activity style widget?
- add_rewrite_rule to load different page, without changing URL in browser
- implement custom roles in custom plugin
- WordPress Custom Hook with Class method
- Create category for each user
- How to get current cart values using WC_Shortcodes?
- Error using wordpress functions inside a plugin class
- Attempting to list all product categories and the price range of all products within them
- Allow a particular user to access a particular plugin?
- Can I add Short Code Of A Plugin In The Code Editor of WordPress?
- WP Function does not trigger on Webhook API Call
- Why do I need to reload the page for WordPress to see the new custom field added with jQuery
- the_posts_pagination() not working if I add wp_head() to header.php
- How to copy the all WordPress media items to another custom plugin folder?
- How to fetch WordPress database values in JavaScript widget
- Cookie value changes back to previous value after changing
- FPDF for creating pdf diplomas
- Adding custom post category to categories widget
- Mobile Menu and Mobile Sidebar missing
- how to define a html folder to make it work with WordPress commands
- Alternative Hook to the_content for Changing Background Color
- Unpublished Pages Failing To Appear On Custom Path
- Creating an array from form inputs before it is posted to the options database
- add a hook of Woocommerce to a plugin but it only shows and doesn’t function properly
- Change language in SiteOrigin Widgets
- Post source link plugin – small modification
- Is there any way to sync Facebook Comments and with comments on WordPress website?
- WordPress default post categories meta box widget
- Fatal error “Call to undefined function is_plugin_active” each time the plugin is activated