sbrajesh

Brajesh Singh

Jan 31st, 2011
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. <?php
  2. /**
  3. Plugin Name: S3 slideshow widget, uses s3 slider plugin
  4.  
  5. */
  6.  
  7. class S3_Slideshow_Widget extends WP_Widget{
  8.  
  9. function s3_slideshow_widget() {
  10. parent::WP_Widget( false, $name = __( 'S3 Slideshow', 'bpmag' ) );
  11. }
  12.  
  13. function widget($args, $instance) {
  14. extract( $args );
  15.  
  16. echo $before_widget;
  17. if(!empty($instance['title']))
  18. echo $before_title. $instance['title']. $after_title;
  19.  
  20. if (function_exists(s3slider_show())) { s3slider_show(); }
  21.  
  22. echo $after_widget;
  23. }
  24.  
  25. function update( $new_instance, $old_instance ) {
  26. $instance=$old_instance;
  27. $instance["title"]=$new_instance["title"];
  28. return $instance;
  29. }
  30.  
  31. function form($instance){
  32. $instance=wp_parse_args((array)$instance,array("title"=>"S3 Slideshow"));
  33. $title=strip_tags($instance["title"]);?>
  34. <p>
  35. <label for="slide-widget-title"><?php _e('Title:', 's3'); ?>
  36. <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo attribute_escape( stripslashes( $title ) ); ?>" />
  37. </label>
  38. </p>
  39.  
  40. <?php
  41. //for showing the form code
  42. }
  43.  
  44.  
  45.  
  46.  
  47.  
  48. }
  49.  
  50. function register_s3_widget() {
  51. add_action('widgets_init', create_function('', 'return register_widget("S3_Slideshow_Widget");') );
  52. }
  53. add_action( 'plugins_loaded', 'register_s3_widget' );
  54.  
  55.  
  56.  
  57. ?>
Add Comment
Please, Sign In to add comment