Template For Wordpress Widget


/ Published in: PHP
Save to your folder(s)

Template For Wordpress widgets.


Copy this code and paste it in your HTML
  1. /*
  2. Plugin Name: Your Plugin Name Here
  3. Plugin URI: http://yourpluginsite.com
  4. Description: This displays your Blogs in your WP Network
  5. Author: The Author Name Here
  6. Version: 1.0.0
  7. Author URI: http://theauthoraddress.com
  8. */
  9. class My_Widget extends WP_Widget {
  10.  
  11. public function __construct() {
  12. // widget actual processes
  13. }
  14.  
  15. public function form( $instance ) {
  16. // outputs the options form on admin
  17. }
  18.  
  19. public function update( $new_instance, $old_instance ) {
  20. // processes widget options to be saved
  21. }
  22.  
  23. public function widget( $args, $instance ) {
  24. // outputs the content of the widget
  25. }
  26. }
  27. add_action( 'widgets_init', create_function( '', 'register_widget( "My_Widget" );'

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.