WordPress   

Create custom widget area(dynamic sidebar) in WordPress

Paste following code in the functions.php file and it will add Custom Sidebar widget area in WordPress widgets page.

register_sidebar(
	array(
		'name'          => __( 'Custom Sidebar', 'textdomain' ),
		'id'            => 'custom-sidebar',
		'description'   => __( 'Custom Sidebar widget area', 'textdomain' ),
		'before_widget' => '<div id="%1$s" class="custom-widget %2$s">',
		'after_widget'  => '</div>',
		'before_title'  => '<h3 class="widget-title">',
		'after_title'   => '</h3>',
	)
);

Now paste following tiny code snippet in the template where you want to show widgets from this newly created widget area.

dynamic_sidebar('custom-sidebar');
Need a helping hand in fixing your website issues?

If you are facing any problems in implementing these code snippets and tutorials, you can hire us to fix your website issues.

Hire Us