WordPress Widget Creation – An Introduction


I am sharing my experience in WordPress Widget creation, as I have learned for some client of mine.

To create a widget, we only need to extend the standard WP_Widget class and some of its functions.

 Open functions.php and add the lines below:

class My_Widget extends WP_Widget {

         public function __construct() {

               // widget actual processes

        }

        public function form( $instance ) {

               // outputs the options form on admin

        }

         public function update( $new_instance, $old_instance ) {

               // processes widget options to be saved

        }

         public function widget( $args, $instance ) {

               // outputs the content of the widget

        }

 }

register_widget( ‘My_Widget’ );

 

 We first create a class named as My_Widget and it will be derived from base class WP_Widget 

the initial value that will be processed by a class by Using the function __ construct ().

Below is the coding –

public function __construct() {

          // widget actual processes

          parent::WP_Widget(false,’My Widget’,’description=New Widget Description’);

}

 

Then there are three functions used by a widget from wordpress is

function form (), function update (), function widget ().

1) Function form()

public function form( $instance ) {

             // outputs the options form on admin

          echo ‘include html coding goes here’;

}

 In this function serves to display widget on the page backend.

 2. Function update()

public function update( $new_instance, $old_instance ) {

             // processes widget options to be saved

}

This function is used to save the options in the database.

3. Function widget()

public function widget( $args, $instance ) {

                 // outputs the content of the widget

}

 

This function is used to display the results on the web client.

Then register_widget is used to register a class to the widget WordPress.

 

I will write a small widget in WordPress in my next post.

Comments are welcome.

Enter your email address:

Delivered by FeedBurner

Preparing for Big Data Technologies


This is a preparation check-list for migration path of a beginner in Big Data Technologies from J2ee Application Area.

The list can be –

  • For windows OS users – learning Linux commands is a must.
  • Using HDFS will need help of many Linux Commands
  • One should acquire a in-depth knowledge of Map-Reduce Framework.
  • Map-Reduce programming is different from traditional Java Programming. So one should practice it before.
  • Before going into any Commercial  version of Big Data Technologies one should have gone through Apache Hadoop.
  • One should gather knowledge in HBase as this data storage is different from traditional RDBMS.
  • One should go through http://bigdatauniversity.com/ courses in Big Data Technologies
  • Also someone should practice the Hadoop clustering for mutiple machine environment and simulate the working environment with namenode and datanode with physically different machines.
  • One should not place the hardwares and softwares in production, unless and until he/she has done the prior experimentation in open source big data technologies with commodity machines.

If I find other step/s useful, I will update in this post.

All comments are welcome.

Enter your email address:

Delivered by FeedBurner