There is absolutely no problem with registering several widgets inside one file. Widgets are separate classes, and unlike other programming languages, PHP will have no problem with your declaring two classes inside one file.
add_action( 'widgets_init', 'src_load_widgets' );
function src_load_widgets() {
register_widget( 'Widget_SRC' );
register_widget( 'Widget_Rank ' );
}
class Widget_SRC extends WP_Widget {
// ...
}
class Widget_Rank extends WP_Widget {
// ...
}
Related Posts:
- Between functions.php (theme), widgets, and plugins, which is loaded first?
- Conditionally enqueue a widget’s script/stylesheet in HEAD (only when present on page!)
- Plugin upgrading: Widget settings
- Need to create a Theme demo site that features multiple themes
- Adding a widget programmatically
- Delete Custom Dashboard Widgets
- Override dynamic_sidebar() in plugin?
- Is dynamic forms/entries possible in Widget?
- How To Add an Extra Field in All WordPress Available Widgets?
- How to place random widgets in the WordPress sidebar?
- Pages with 2 Columns
- Custom Widget Creating PHP Exception When Placed In Its Own PHP File
- register child class in another plugin
- Conditional Display of Links in Widgets
- How to Get Admin Settings for a widget when using the_widget() with custom widget
- How to unregister a widget from a child theme
- Created Widget Not Showing up on Admin Panel
- Setting up widgets in wordpress with a unique ID for the after_title argument
- How to exclude a widget from page 1 of a paginated post
- how can i limit the number of instances for my widget
- Dashboard Widget Form
- Admin Dashboard with Custom Tab for Client
- WordPress author details plugin/widget
- The called constructor method for WP_Widget in GFWidget is deprecated since version 4.3.0! Use
- WAMP to XAMPP WordPress transfer
- How to check if you are on widget.php page?
- The plugin generated 3 characters of unexpected output during activation
- Theme’s default styles are overriding my plugin’s custom CSS
- Rotate Widgets or Content Blocks every x sec/min
- Multi language site [closed]
- How to style the RSS wordpress?
- How can I disable widget from being visible on some pages?
- How to display more than one instance for a widget?
- Custom random quote widget breaks when used in multiple sidebars
- Hooking in to replace the Sidebar/Widget areas
- Do widget options need to be escaped widget()?
- Ajax contact form widget plugin data not insert in database
- How to hide CSS by default and show on button press
- In the archive widget, how do I sort in between two years?
- Widgets Scripts don’t load – but load when I reload the page
- How to add wp visual editor in a custom widget?
- How to get my plug-in, wrote in php, to refresh on its own every 5 minutes?
- WordPress Widget – Saving multidimensional arrays into $instance
- Custom plugin appears outside of the sidebar container
- Char limit on custom blog-post form? [closed]
- How do I use wp_editor() in widget form?
- How to reorder and display a feed to be chronological?
- Hide certain widgets from specific user roles in admin
- How to add Wrapper Div/container element around WordPress Widget Content
- How do I find out what is in control over a certain part of a website?
- Sidebar widget: Randomly select text from a given set
- Best practice for including plugin output in a template without using shortcode?
- How do I use add_action on custom widget?
- Exclude posts from widget while post is showing on home, single and categories
- Custom widget doesn’t save values from dropdown box
- Register Script in Plugin Widget
- Add Shortcode tag in Widget/Sidebar
- How to create wordpress widget that is fixed position on the home page
- jQuery Click event is not fired at all
- strange shortcode error: does shortcodes requires any dependency?
- All custom widgets are not showing in widget area at the same time
- Widget for specific category
- get_term_meta returns false in widget
- How to set the default value as the saved value once a form of widget is saved?
- My widget won’t update its values when save is clicked
- Extend a plugin to include a widget option
- Is there a Image Gallery which will load all my posted Images like twitter’s image grid?
- Modify pages widget and make a plugin?
- Listing all sidebars
- Unable to locate inline CSS causing parts of page to be blank
- Table of contents (TOC) plugin is not showing header tag
- 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 to fetch WordPress database values in JavaScript widget
- RSS Feed on WordPress showing code (hypertext) in articles titles
- What is the right way to populate a dropdown from MySql?
- Change WordPress plugin widget `id_base` without breaking widget
- Co-author plus: list of posts by authors in the sidebar
- Shortcode generated widget to appear on same line as heading text and button
- Widget logic using woocommerce product category
- How to display widget in front end?
- Widget outputs the value but doesn’t save anything inside the textarea
- How to add styling and script to a custom widget plugin
- WordPress Widget: Is it possible to make the form dynamic without updating?
- Using Widget Logic to place menu on multiple pages?
- Show widget location borders for development
- Cannot access variables within a widget
- How know the “admin” blog from wordpress multisite?
- twitter widget loads properly in all themes except my own theme?
- adding image in the header of my dev widget
- Plugin: Unable to Save the Image Alignment Option to Display in the Widget in the Sidebar
- How to get certain part from widget
- What method should I use for a sidebar widget that reads latest posts?
- pre-upload text and video for the future
- Last article Widget with text preview and more button
- What are the downsides of using bootstrap in plugin development?
- Can’t edit Contact Us form on front page
- Sidebar Slideshow widget with text [closed]
- Am having issues intergrating this api into my wordpress site, any help please?
- WordPress child theme widget customization – Eduma
- Widget saving but showing “waiting” animation [closed]