Skip to content

Instantly share code, notes, and snippets.

@carlodaniele
Created May 1, 2017 14:16
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlodaniele/c63babea63df98a92fea9f42af3b8358 to your computer and use it in GitHub Desktop.
Save carlodaniele/c63babea63df98a92fea9f42af3b8358 to your computer and use it in GitHub Desktop.
<?php
/**
* @package Kinsta_widget
* @version 1.0
*/
/*
Plugin Name: Kinsta Widget
Plugin URI: http://wordpress.org/extend/plugins/#
Description: This is an example plugin
Author: Your Name
Version: 1.0
Author URI: http://example.com/
*/
class Kinsta_Widget extends WP_Widget {
/**
* Sets up the widgets name etc
*
* @link https://developer.wordpress.org/reference/classes/wp_widget/__construct/
* @see https://developer.wordpress.org/reference/functions/wp_register_sidebar_widget/
*
*/
public function __construct() {}
/**
* Outputs the content of the widget on front-end
*
* @param array $args Widget arguments
* @param array $instance
*
* @link https://developer.wordpress.org/reference/classes/wp_widget/widget/
*/
public function widget( $args, $instance ) {}
/**
* Outputs the options form on admin
*
* @param array $instance The widget options
*
* @link https://developer.wordpress.org/reference/classes/wp_widget/form/
*/
public function form( $instance ) {}
/**
* Processing widget options on save
*
* @param array $new_instance The new options
* @param array $old_instance The previous options
*
* @link https://developer.wordpress.org/reference/classes/wp_widget/update/
*/
public function update( $new_instance, $old_instance ) {}
}
// register Kinsta_Widget
add_action( 'widgets_init', function(){
register_widget( 'Kinsta_Widget' );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment