How do I register multiple widgets with a single class definition?
You don’t. Modern class based Widget API in WP assumes that one class corresponds to one widget. Note that you can still have intermediary subclasses – (extend WP_Widget
, then extend it once more) but what you register in the end is still one widget per class.
From your question it’s not very clear what your mustache templates are functionally and how varied they are.
If they are similar enough what you could do is create single widget and expose template list in interface to choose for each widget instance.
Related Posts:
- Loading scripts only if a particular shortcode or widget is present
- Add class to before_widget from within a custom widget
- Is there any way to dynamically alter widget titles?
- Show post tags in a widget
- Author template, filter sidebar widgets by author?
- WordPress 4.8: Using multiple WYSIWYG-Editors with media inside of Widgets how to?
- Get page IDs based on which template they are using?
- Loop through widgets in sidebar
- Woocommerce Product Category Widget – hide categories that have no products in stock [closed]
- Role that can edit only widgets, not other theme options
- When to use which plugin output method?
- Hooking Into Widget Output Loop
- how to extend a WP_widget twice
- Inserting shortcode [stream /] into a Text widget
- WordPress: Apply filter/hook to a particular sidebar widgets?
- How can I add a new CSS class to a widget?
- wordpress widget textbox in the sidebar
- parse json object and display live in wordpress php widget
- Creating a one click demo importer
- Using jQuery in widget development
- duplicate sidebar
- How to check if searchform.php is being included as widget?
- Is it possible to enqueue a script from a widget method (of extended WP_Widget object)?
- How to get sidebar’s content inside admin-ajax?
- Full width layout for custom post type pages
- wp_count_posts, wp_count_terms and wp_count_comments for specific user?
- Why does WordPress stores widget options in a multidimensional array?
- what is option_name on database that store the information of current initiate widget in frontend sidebar?
- Widget – Store and update data
- Run JS after widget settings are saved?
- Shortcode displays always first. Once again
- Can I create drag and drop widgets like iGoogle in WordPress?
- Making the default “Latest Posts” WordPress Widget Show Thumbnails
- Display the id list of active widgets of same sidebar?
- How to remove a widget from the sidebar on specific page?
- When adding a widget, what kind of widget should I used to add images and text and styling?
- Add description to custom text widget and display the 5 recent post titles
- Add individual tag to widget title in sidebar
- Where do I save widget code for wordpress?
- Is there any way to print a widget by having its id?
- How to allow your custom widget as block in gutemberg editor
- How to save widget fields generated from an array?
- Create a widget to use shortcode?
- Need help using a filter on the default Categories widget
- Print owned created widget
- widget dropdown menu code
- isSavingPost() for widgets
- Content of widgets keep disappearing over and over again
- custom widget does not saved value
- Add visual editor style only on widgets.php page
- php to add a link into wp widget without specific url
- Widget Select Options not saving
- Edit and make class-wc-widget-featured-products.php update-proof
- Display Widgets Horizontally in Area [closed]
- Copy Widget Settings because of changed IDs
- Show a widget as a sidebar fallback
- disbale default widgets on theme activation
- function WP_Widget::widget() must be over-ridden in a sub-class. when create new Widget
- I have a widget area in my header. How can I have that display a different widget depending on what group is shown?
- change widget to display excerpt instead of content
- How do widgets access posts they should display?
- Remove links from meta widget
- How to register a widget when saving a post?
- How to make home widgets appear horizontally
- Using more widget in main page cause slow loading WordPress? [closed]
- WordPress custom widget undefined variable notice
- Multiple rows of footer widget areas
- How do I make the title of the following widget editable?
- Escape HTML on WP input
- How do I exclude portrait pictures from the nextgen gallery sidebar widget?
- How to use multiple instances of Deal or Announcement With Countdown Timer Plugin Widget
- Changing the order of widgets according to current page?
- How to remove date in Recent Post widget?
- Truncate Widget Title
- A message to clients in the dashboard widget received from another site
- Widgets are not displaying in my theme
- how to make video autoplay in widget
- Can view Social Media buttons only in the private mode – why?
- Reload widget with AJAX
- Function for widget titles
- Custom archive widget drop down menu
- Prevent widgets from disappearing when swtiching from parent to child theme
- How to show Widget in Content Bottom part on home page in twenty sixteen theme
- get_post_class not working properly
- Is it good practice to change certain page appearance through a widget?
- widgets_init actions not fired from functions.php’s child theme
- Randomizing the RSS Widget
- How to get data from one wordpress site to another
- Get widget locations in WordPress plugin
- Why is the phone number a hyperlink on desktop sites, in my widget?
- $before/after_widget/title not displaying anything
- can’t edit widgets after moving from subfolder to root
- register_sidebar() will not wrap an element properly
- Page full of widgets?
- Big side banners
- Widget page broken
- wordpress random widget widget
- Widget Disappearing in IE
- How to exclude a widget from showing up on a page?
- jQuery “on” handler does not fire on newly inserted widgets [closed]