how to add text widgets to wordpress sidebar using function?

admin

Administrator
Staff member
I want to add text widget into my site sidebar when I activate theme. How can I do this using wordpress function or other methods? I'm using wordpress 4.1.
Help me. Thanks.