http://wordpress.org/support/profile/mr49online

Create a new php file in your plugin directory called my-hello-world.php, and copy/paste the following plugin code:

<?php
/*
Plugin Name: Hello World
Plugin URI: https://mr49online.wordpress.com/
Description: Sample Hello World Plugin
Author: Muhammad Farhan
Version: 1
Author URI: https://mr49online.wordpress.com/
*/

function sampleHelloWorld()
{
echo "<h2>Hello World</h2>";
}

function widget_myHelloWorld($args){
extract($args);
echo $before_widget;
echo $before_title;?>mr49online widget <?php echo $after_title;
sampleHelloWorld();
echo $after_widget;
}

function myHelloWorld_init() {
register_sidebar_widget(__('Hello World'), 'widget_myHelloWorld');
}

add_action("plugins_loaded", "myHelloWorld_init");
?>

To activate this plugin move towards Admin > Plugins, and find “Hello World” from list.

To place this widget in Sidebar move towards Admin > Appearance > Widgets, and play with drag & drop 🙂

Fore more detail please, click here .

Advertisements

Comments on: "How To Create WordPress Widgets" (4)

  1. Spot on with this write-up, I really suppose this web site needs much more consideration. I?ll most likely be again to read much more, thanks for that info.

  2. I was recommended this wordpress by way of my cousin. I am not sure whether this submit is written by way of him as nobody else recognise such certain about my difficulty. Thanks! You’re wonderful!

  3. WONDERFUL Post.thanks for share..extra wait .. ?

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: