Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class my_widget extends WP_Widget {
- public function __construct() {
- //logic here
- }
- public function widget($args, $instance) {
- //logic here
- }
- public function form($instance) {
- //logic here
- }
- public function update($new_instance, $old_instance) {
- //logic here
- }
- }
- //registering my widget so its available in the back-end
- add_action('widgets_init', function() {
- register_widget('my_widget');
- });
- //lets define a constant for the URL to your theme folder
- define('YOUR_THEME_FOLDER_PATH', trailingslashit(get_template_directory(__FILE__)));
- //lets load the custom widget
- require_once (YOUR_THEME_FOLDER_PATH . 'inc/class.my-widget.php');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement