| Server IP : 14.225.204.176 / Your IP : 216.73.216.252 Web Server : nginx/1.24.0 System : Linux nodejs-ybgk 6.8.0-40-generic #40-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 5 10:34:03 UTC 2024 x86_64 User : root ( 0) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/php/langngon.com/wp-content/themes/langngon/lib/ |
Upload File : |
<?php
/*
Plugin Name: Sample WordPress Widget
Plugin URI: http://timtrott.co.uk/
Version: 1.0
Description: How to create a WordPress Widget
Author: Tim Trott
Author URI: http://timtrott.co.uk/
*/
class LikeUs_Widget extends WP_Widget
{
function LikeUs_Widget()
{
$widget_ops = array('classname' => 'LikeUs_Widget', 'description' => 'My Sample Widget Description');
$this->WP_Widget('LikeUs_Widget', 'Like Us Widget', $widget_ops);
}
function form($instance)
{
$instance = wp_parse_args((array) $instance, array( 'title' => '' ));
$title = $instance['title'];
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>">Title: <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($title); ?>" /></label></p>
<?php
}
function update($new_instance, $old_instance)
{
$instance = $old_instance;
$instance['title'] = $new_instance['title'];
return $instance;
}
function widget($args, $instance)
{
extract($args, EXTR_SKIP);
echo $before_widget;
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
if (!empty($title))
echo $before_title . $title . $after_title;;
// Do Your Widgety Stuff Here...
echo 'Tmp content';
echo $after_widget;
}
}
add_action( 'widgets_init', create_function('', 'return register_widget("LikeUs_Widget");') );
?>