You must first make an area for displaying the widget through the admin panel, then connect the widget in the template file. For the first part, use the code and place it in the template’s functions.php.
register_sidebar(array( 'name' => 'newwidgetblock', // name of the area in admin panel 'id' => 'newwidgetblock_new', // unique ID 'description' => __( 'widget description, optional'), 'before_widget' => '<div id="widget" class="widget">', // block wrapper start 'after_widget' => '</div>', // end of block wrapper 'before_title' => '<div class="widget-title">', // start of the header wrapper 'after_title' => '</div>' // end of the header wrapper ));
Next, find the place in the template files where you want to display this widget, and add the following code:
<?php dynamic_sidebar("newwidgetblock"); ?>