1. Copy this code and save it in plugins folder activate the plugin and enjoy.
<?php /* * Plugin Name:Facebook Like widget author: Arunendra Pratap Rai */ class apr_facebook_widget extends WP_Widget { /** constructor */ function apr_facebook_widget() { parent::WP_Widget(false, $name = __('(apr) Facebook Like Box', 'ocmx'), $widget_options = __('Display a Facebook Like Box.','ocmx')); } /** @see WP_Widget::widget */ function widget($args, $instance) { extract( $args ); if(isset($instance["title"])) $title = esc_attr($instance["title"]); if(isset($instance["facebookpage"])) $facebookpage = esc_attr($instance["facebookpage"]); if(isset($instance["height"])) $height = esc_attr($instance["height"]); if(isset($instance["faces"])) $faces = esc_attr($instance["faces"]); if(isset($instance["colorscheme"])) $colorscheme = esc_attr($instance["colorscheme"]); if(isset($instance["stream"])) $stream = esc_attr($instance["stream"]); if(isset($instance["border"])) $border = esc_attr($instance["border"]); echo $before_widget; ?> <?php echo $before_title; ?> <?php echo $instance['title']; ?> <?php echo $after_title; ?> <?php echo $after_widget; } /** @see WP_Widget::update */ function update($new_instance, $old_instance) { return $new_instance; } /** @see WP_Widget::form */ function form($instance) { if(isset($instance["title"])) $title = esc_attr($instance["title"]); if(isset($instance["facebookpage"])) $facebookpage = esc_attr($instance["facebookpage"]); if(isset($instance["height"])) $height = esc_attr($instance["height"]); if(isset($instance["faces"])) $faces = esc_attr($instance["faces"]); if(isset($instance["colorscheme"])) $colorscheme = esc_attr($instance["colorscheme"]); if(isset($instance["stream"])) $stream = esc_attr($instance["stream"]); if(isset($instance["border"])) $border = esc_attr($instance["border"]); ?>
<?php } } // class FooWidget //This sample widget can then be registered in the widgets_init hook: // register FooWidget widget add_action('widgets_init', create_function('', 'return register_widget("apr_facebook_widget");')); ?>
No comments:
Post a Comment