Created
October 9, 2014 20:02
-
-
Save joeyz/bb9ab7c92fc4d61ca88b to your computer and use it in GitHub Desktop.
Basic Widget Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Custom Mini Cart | |
Plugin URI: https://www.zendesignfitm.com/ | |
Description: A widget framework for jewelry dropdown. | |
Version: 1.0 | |
Author: Joey Z | |
Author URI: https://www.zendesignfirm.com/ | |
License: GPL | |
*/ | |
class Jz_Mini_Cart_Widget extends WP_Widget { | |
/** | |
* Sets up the widgets name etc | |
*/ | |
public function __construct() { | |
// widget actual processes | |
parent::__construct( | |
'jz_mini_cart_widget', // Base ID | |
__('Customized Mini Cart Widget', 'text_domain'), // Name | |
array( 'description' => __( 'Echoes WooCommerce mini cart.', 'text_domain' ), ) // Args | |
); | |
} | |
/** | |
* Outputs the content of the widget | |
* | |
* @param array $args | |
* @param array $instance | |
*/ | |
public function widget( $args, $instance ) { ?> | |
<h1>WIDGET CONTENT GOES HERE</h1> | |
<?php } | |
/** | |
* Outputs the options form on admin | |
* | |
* @param array $instance The widget options | |
*/ | |
public function form( $instance ) { | |
// outputs the options form on admin | |
} | |
/** | |
* Processing widget options on save | |
* | |
* @param array $new_instance The new options | |
* @param array $old_instance The previous options | |
*/ | |
public function update( $new_instance, $old_instance ) { | |
// processes widget options to be saved | |
} | |
} | |
add_action('widgets_init', | |
create_function('', 'return register_widget("Jz_Mini_Cart_Widget");') | |
); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment