Posts

Showing posts from February, 2022

How To Create Your Own Custom Widgets Wordpress

How To Create Your Own Custom Widgets Wordpress Wordpress provide a functionality to create your own custom widgets for this we have function that initilize your widget widgets_init . By using this function you can initilize your custom widget and call them by using dynamic_sidebar('customsidebarwidget') . Let create our own widget function custom_sidebar_widget(){ register_sidebar(array( 'name' => __('Custom Sidebar Widget', 'customsidebarwidget'), 'id' => 'customsidebarwidget', 'description'=> __('Your description about your widget', 'customsidebarwidget'), )); } add_action( 'widgets_init', 'custom_sidebar_widget' ); custom_sidebar_widget it's name of function that you used with widgets_init in Hook i.e. add_action( 'widgets_init', 'custom_sidebar_widget' ) . and inside this function you can describe your widget detail inside re