Many of the times, we saw that we are not able to do some very easy tasks. One of them is â€œAdding widgets in wordpressâ€. In this tutorial, I will show you how to â€œAdd widgets in wordpressâ€.
Follow these steps:
Open yourfile and then copy and paste the following code in that file:
'id' => 'category'
add_action( 'widgets_init', 'arphabet_widgets_init');
Now Go to the admin section of your wordpress website and then go to Appearance/ widgets. There you will see the widget title with name â€œfooterâ€. This was the name given in the code as â€˜nameâ€™ => â€˜footerâ€™.
Now drag and drop the widgets you want to add to your widget area.
Now your widget is set. Its time to use those widgets in your page. To do so you have to open that page in which you want to show the widget. Generally, we add widgets to the sidebar or in the footer. In this tutorial, I am adding widget to the footer so I will open thefile and then add the following code to it.
<?php dynamic_sidebar( 'search' ); ?>
Note: Here â€˜searchâ€™ is the id given in the code infile as â€˜idâ€™ => â€˜searchâ€™
Now your page is ready with your widget.
6 total views, 3 views today