How to Create a Custom WordPress Widget

Add in function.php file in wp-content/twentytwelve

Below Widget function.

register_sidebar( array(
'name' => __( 'widget name', 'twentytwelve' ),
'id' => 'widget id',
'description' => __( 'Appears on posts and pages except the optional Front Page template, which has its own widgets', 'twentytwelve' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );

And See Admin Panel.

Now, you can call this Custom widget  using following  code

<?php dynamic_sidebar('widget name'); ?>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

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