Advertisement
Guest User

Untitled

a guest
Feb 24th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. class my_widget extends WP_Widget {
  2.  
  3. public function __construct() {
  4. //logic here
  5. }
  6.  
  7. public function widget($args, $instance) {
  8. //logic here
  9. }
  10.  
  11. public function form($instance) {
  12. //logic here
  13. }
  14.  
  15. public function update($new_instance, $old_instance) {
  16. //logic here
  17. }
  18.  
  19. }
  20. //registering my widget so its available in the back-end
  21. add_action('widgets_init', function() {
  22. register_widget('my_widget');
  23. });
  24.  
  25. //lets define a constant for the URL to your theme folder
  26. define('YOUR_THEME_FOLDER_PATH', trailingslashit(get_template_directory(__FILE__)));
  27. //lets load the custom widget
  28. require_once (YOUR_THEME_FOLDER_PATH . 'inc/class.my-widget.php');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement