WordPress widget is a simple approach to include substance and particular elements into your site.
You simply need to move and customize the gadget into any widgetized territory like sidebar, footer or header of your site and begin utilizing its usefulness.
Note– Try WordPress topics, that accompanies incorporated widgetized sidebar and footer. This will spare your time from custom coding.
This is a WordPress gadget instructional exercise, where you will figure out how to make a custom gadget in WordPress utilizing the module.
When you initiate this module, the gadget will be recorded under the gadget territory of the WordPress.
In the wake of understanding this article, you can make a WordPress custom menu gadget rapidly.
This is the code that you should write the function.php file. Then automatically a widget post type is created with the help of which you can add the widget wherever you want.
/**
* Register widgetized areas.
*/
function ATMT_widgets_init()
{
register_sidebar( array(
'name' => __( 'Contact Info', 'ATMT' ),
'id' => 'contact-info',
'description' => __( 'Widgets in this area will be shown on all posts and pages.' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>',
) );
}
/** Register sidebars by running ATMT_widgets_init() on the widgets_init hook. */
add_action( 'widgets_init', 'ATMT_widgets_init' );
/***** End Register widgetized areas. *****/
Here we are creating a widget for the footer so from the widget post type we select the text widget then from the footer section we remove all the HTML code and write this one line of code. i.e.
<?php dynamic_sidebar('contact-info'); ?>
0 Comment(s)