You have to hook your widget registering like that:
add_action("widgets_init", "register_widgets");// Hook WP
/**
* Register widgets
*/
function register_widgets() {
require_once "FooWidget.php";
register_widget("FooWidget");
}
Same for the widget zones
add_action("widgets_init", "register_widgets_zones");
function register_widgets_zones() {
register_sidebar(array(
"name" => "Foo Zone Page",
"id" => "foo-zone-widgets",
"class" => "panel",
"before_widget" => '<div id="%1$s" class="widget %2$s">',
"after_widget" => "</div>",
"before_title" => "",
"after_title" => "",
));
Related Posts:
- WordPress and magic quotes
- Reposition WooCommerce breadcrumb outside of wrapper content
- WordPress URL Rewrite not working
- How display widget by id
- Displaying a WooCommerce product via PHP
- WP E-commerce: Showing 3 random products from current category when viewing product
- Create Image Uploader for Widget
- Woocommerce -How to set product regular price default
- How to pass JavaScript variable to PHP in wordpress widget?
- Displaying a variable stored in functions.php inside widget
- Check if widget has content
- WordPress widget / plugin….fields not appearing in my widget
- Custom Widget outputs the input but doesn’t save anything inside the textarea
- display most popular tags in two columns
- List authors with posts in a category
- Woocommerce price including tax with formatting from options
- How to add Shortcode (font awesome) in widget title?
- How to exclude a widget from page 1 of a paginated post
- Show Specific Footer Widget for Specific Pages
- dynamic sidebar not showing anything
- Dashboard Widget Form
- nowplaying.include.php Will Not Display Results
- javaScript in section of WP API
- Style every second widget?
- Add before_content and after_content to register_sidebar
- PHP Deprecated: WP_RSSjb has a deprecated constructor
- WordPress widget/sidebar dividers?
- 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
- How to run JS, PHP and etc. inside WP post?
- How to add just one specific page to widget without plugin?
- How to output widget
- WordPress plugin/code to hide all things related of a user from the public
- Adding widgets to my plugin page instead of WordPress dashboard
- WordPress Widget Not Saving Data
- Why my image upload button is not working in wordpress widget area?
- How to get my plug-in, wrote in php, to refresh on its own every 5 minutes?
- Large Woocommerce Site (83,000 items), What Can I Do? [closed]
- How can I hide that I Use WordPress (with W3 Total Cache)
- WooCommerce Tabs [closed]
- How to determine if the sidebar is empty? Or not active?
- How to make widget title accept php?
- Call plugin with php function
- Is it bad to add html to a widget by closing and reopening the php tags?
- Widget back end radio button issue
- How to solve Woocommerce Memory Limit
- Why doesn’t PhotoSmash plugin play well with wp_query?
- Correctly Using checked function of WordPress
- How to get post category list as select in front-end?
- Simple php in wordpress widget [closed]
- display specific widget to a page
- Dynamically display font icons in widget
- Correct code to use php in text widget
- random reason on refresh
- Add a select-option to the default widgets
- Display additional page templates and a sidebar on plugin activation
- How do I attach an invoice PDF to an email in the Dukapress plugin for WordPress?
- Don’t display a sidebar widget when on a specific page
- Modify pages widget and make a plugin?
- Creating New Dynamic Fields for a Certificate (Number Generation, Code Referencing, and more)
- Some problems in custom widget
- WordPress 6.0 class-wp-widget.php fatal errors in PHP 8.1.6
- How do you create a custom category widget that you can style?
- How to use wp_get_attachment_image or wp_get_attachment_image_src instead of $instance[‘single_feature_image_uri’]
- Loading Widgets Via Child Theme
- Inserting a class on before_widget if checkbox is checked
- Current WordPress Page Title as Search Parameter into A Tag
- dashboard widget form not submit mails
- Add widget area from visual editor
- How to make a “page-option” in WordPress
- Priority call methods – PHPMailer->addAddress(NULL)
- Dynamic_sidebar load in string makeup
- missing admin bar and widget in a template
- My own theme’s custom widget areas are not working
- Add disclaimer before certain posts and pages
- Beyond widget side menu editing, with the php page, custom template
- How to list categories by page id in wordpress
- Are WordPress widgets cached?
- widget: input the px value from user and use it as inline style in widget function
- Update title of every instance of widget using text field
- divide custom field values in div every two values
- Are widget arguments always set inside My_Widget::widget()?
- WP_Widget dynamic field array with external AJAX
- WordPress – registering sidebar and adding a button directly after .textwidget
- WordPress and magic quotes
- Template from scratch: Sidebars not showing widget
- Name Input from widget displays Sidebar name instead of saved data
- WordPress – show number of comments for each post in widget
- key( $GLOBALS[‘wp_registered_sidebars’] ) is always showing the same value
- How to change links in the 3 main categories, on widget category, to a javascript function call
- WordPress Pages into Sections edit.php PHP hack
- PHP Widget and do_shortcode
- How to define template directory in this widget code
- WordPress: Create A Widget to Accompany Plugin
- PHP Syntax getting PHP terms
- How to add homepage Widget?
- WP Debug enabled Undefined index error in a widget
- What can I do to customize a widget provided with this plugin? from where have I to start?
- Get Products within Current Product Category
- what is %variable% in a wordpress plugin? [closed]