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:
- Conditionally enqueue a widget’s script/stylesheet in HEAD (only when present on page!)
- How to enable edit button in the theme’s customize UI?
- Adding a widget programmatically
- Delete Custom Dashboard Widgets
- How to pass JavaScript variable to PHP in wordpress widget?
- Is dynamic forms/entries possible in Widget?
- How To Add an Extra Field in All WordPress Available Widgets?
- Using the media uploader in a custom plugin
- Has anyone been able to get the aweber plugin to work
- How to create a widget or plugin to add custom content to my website?
- Custom Widget outputs the input but doesn’t save anything inside the textarea
- How can I retrieve data within my widget
- How to Get Admin Settings for a widget when using the_widget() with custom widget
- How to unregister a widget from a child theme
- How do I register a stylesheet inside a WordPress widget?
- How to exclude a widget from page 1 of a paginated post
- How to get popular post from across a network?
- Are there plugins that interfere with the admin part of Rss widget?
- how can i limit the number of instances for my widget
- Dashboard Widget Form
- I need some direction on how to have a sidebar based on meta rather than page
- How can I reuse the WordPress search form for a custom plugin / widget?
- Passing $this->get_field_name() to javascript
- Is there plugin to show recent posts from one website in the widget area of another?
- Can I use a form in a dashboard widget?
- Ajax gives 400 error
- Missing argument 3 for wp_register_sidebar_widget()
- The called constructor method for WP_Widget in GFWidget is deprecated since version 4.3.0! Use
- I wrote my plugin. How to display the result of the plugin’s function to sidebar (widget?)?
- How to check if you are on widget.php page?
- I have no idea “How change font for elements in widget?”
- How to save additional user data as part of the registration process?
- Theme’s default styles are overriding my plugin’s custom CSS
- Adding widgets to header and footer from plugin
- Rotate Widgets or Content Blocks every x sec/min
- Do widget options need to be escaped widget()?
- Ajax contact form widget plugin data not insert in database
- How to remove traces from widget during uninstallation
- Which widget to use for display category post with view more? [closed]
- WordPress Widget Not Saving Data
- Calendar Plugins – Featured Widget [closed]
- In the archive widget, how do I sort in between two years?
- WordPress plugin subscribe2 not looking the same as before migration
- Wysiwyg editor errors
- How to make WordPress customizable for clients
- How to get my plug-in, wrote in php, to refresh on its own every 5 minutes?
- Conditional tag in Widget Logic for checking if top level page or if subpage
- Char limit on custom blog-post form? [closed]
- Trying to create a table/list of my EventBrite course listings [closed]
- How to add Wrapper Div/container element around WordPress Widget Content
- Disabling plugin but wpenqueue is not available
- Related posts widget or plugin needed
- Problem since update 3.5 [duplicate]
- Call plugin with php function
- How to disable a widget when dependent plugin is inactive?
- How can I delete a wordpress widget instance?
- Saving widget options from class method
- How to handle forms from sidebar widgets – Processing $_POST variables using get_field_name()
- Short messages widget [closed]
- Widget’s container?
- Add SideBar/Widgets Just Below the Post
- WordPress Widget Not Saving Instance
- How to display a widget on a page with no theme?
- Widget where it can make changes to the container
- Widget content turns up before title
- Modify pages widget and make a plugin?
- wp_footer hook running twice
- Why aren’t my Follow Me links working?
- Is there any plugin to show number of clicks on the link?
- Creating New Dynamic Fields for a Certificate (Number Generation, Code Referencing, and more)
- co-authors plugin – inline listing
- How can I display selected content from a seperate database in an Activity style widget?
- RSS Feed on WordPress showing code (hypertext) in articles titles
- Change language in SiteOrigin Widgets
- Some Widgets in the Right Side Bar and the whole Footer section is not working in a WordPress Site
- Using foreach loop for `$instance` of form and update array widget iteration
- Shortcode generated widget to appear on same line as heading text and button
- How do I keep children of certain parent menus expanded by default on a sidebar?
- Registered sidebar area is not shown from plugin.
- Widget logic using woocommerce product category
- Using slightly modified widget
- How to make wp multisite subdomain exist search
- Custom Widget not Available after Plugin Installation
- Plugin Works, but Widget Doesn’t
- Widget Script Loads at Bottom of Page
- Use of apply_filter in plugin/widget class
- jquery conflict with widget page
- Template from scratch: Sidebars not showing widget
- Widget redirecting to home page
- Plugin won’t activate, fatal error (widget class not found)
- WordPress plugin not eching popular posts
- Trying to output a “Most visited blogs” list in wordpress multisite
- How to use template field in the Event Organiser plugin widget
- How to develop an extension for a simple form post and post back? [closed]
- How to add homepage Widget?
- What can I do to customize a widget provided with this plugin? from where have I to start?
- Is it possible to control content on different pages by checkboxing wich content is shown where on a wordpress theme page?
- Content expands beyond its column container [closed]
- Issue with customizer and widget page
- Footer option is missing in Customiser