Posts

Showing posts with the label custom-widget

How to Create a custom widget for wordpress sidebar

How to create a custom widget for your theme or custom plugin , just copy and paste below code and paste it into your theme's functions.php or your custom plugin file class showtable_widget extends WP_Widget { function __construct() {     global $wpdb; parent::__construct( 'showtable_widget',   // custom widget slug put slug whatever you like __('Show xml feed table', 'showtable_widget'),   // widget title display in admin side widget area array( 'description' => __( 'Display feed table in sidebar ', 'showtable_widget' ), )  // description for );    // your widget purpose } public function widget( $args, $instance ) {   // this function use for display data frontend side      global $wpdb; $title = apply_filters( 'widget_title', $instance['title'] ); echo $args['before_widget']; if ( ! empty( $title ) ) echo $args['before_title'] . $title . $args['after_title']; // c...