How to create custom widget in WordPress ?

Hi guy’s today i am gonna tell you how to create custom widget in WordPress. Widget is a very important part when you are building website in WordPress. Basically WordPress already have some widgets but when we are building the site we needs the more widgets to use in the site so follow these instructions to create widget in WordPress.



Before moving on let me tell you one thing that Please do not create new function for widget it has already present there you just have to add some code within the function and thats it. See the below instructions.

Step 1

Please put these code in your function.php file within this function.

function themename_widget_init()
{
your widget code goes here ..
}

Your widget code will be

register_sidebar( array(
    'name' => __( 'Widget Name', 'themename' ),
    'id' => 'widget_id',
    'description' => __( 'widget description.', 'themename' ),
    'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    'after_widget' => '</aside>',
    'before_title' => '<h3 class="widget-title">',
    'after_title' => '</h3>',
) );

and your done now go to WordPress backend go to widget under appearance you can see the new widget name “Widget Name” you can change name whatever you wish to.

Please see this screenshot

widget

Now you can display this widget anywhere by using this function

<?php dynamic_sidebar('widget-id'); ?>

Hope you like this tutorial if you have any question or comments please fill the form below. We would love to help you anytime.
Good Luck !

27 thoughts on “How to create custom widget in WordPress ?”

  1. WordPress as of now have a few gadgets yet when we are build the site we have to needs the more gadgets to use in the site so take after these directions to make gadget in WordPress.

  2. much obliged to you for an incredible post.
    Your site is truly cool and this is an incredible moving article. Much obliged to you to such an extent.

  3. howdy, your websites are really good. I appreciate your work. Questions to Ask Your Boyfriend

  4. Your blog provided us with valuable information to work with. Each & every tips of your post are awesome. Thanks a lot for sharing. Keep blogging..

  5. Impressive web site, Distinguished feedback that I can tackle. Im moving forward and may apply to my current job as a pet sitter, which is very enjoyable, but I need to additional expand. Regards.

  6. Been sitting eyes wide open behind these four walls, hoping you’d call It’s just a cruel existence like there’s no point hoping at all. Baby, baby, I feel crazy, up all night, all night and every day Give me something, oh, but you say nothing. What is happening to me? I don’t wanna live forever, ’cause I know I’ll be living in vain. And I don’t wanna fit wherever. I just wanna keep calling your name until you come back home.Thank you

  7. I’ve been sleepless at night. ‘Cause I don’t know how I feel. I’ve been waiting on you
    Just to say something real.There’s a light on the road. And I think you know. Morning is coming. And I have to go.I don’t know why, I don’t know why. We need to break so hard. I don’t know why we break so hard But if we’re strong enough
    To let it in. We strong enough. To let it go.

  8. I can’t read articles online all the time, yet I’m happy I did today. This is exceptionally elegantly composed and your focuses are very much communicated. Kindly, never quit composing. His Secret Obsession Review

  9. There is such a great amount in this article I would never have considered all alone. Your substance gives perusers things to consider in an intriguing way. Much obliged to you for your unmistakable data.

  10. Thank you for some other informative blog. Where else could I get that type of information written in such an ideal means? I have a mission that I’m just now working on, and I have been at the look out for such information.

  11. I was reading your article and wondered if you had considered creating an ebook on this subject. Your writing would sell it fast. You have a lot of writing talent.

  12. Thanks for the sharing this great article related to The Future of the Web.. this article is very usefull for me.Thanks again for sharing this great article!

  13. I found a lot of interesting information here. A really good post, very thankful and hopeful that you will write many more posts like this one.

  14. I’ve perused some well done here. Certainly worth bookmarking for returning to. I shock the amount of exertion you put to make such an incredible instructive site.

  15. I am happy you take pride in what you compose. This makes you stand way out from numerous different essayists that push inadequately composed substance. Love quotes

  16. Pretty helpful material, much thanks for this article

  17. by visiting this site I found cool stuff here keep it up.

  18. You make such a large number of extraordinary focuses here that I read your article two or three times. Your perspectives are as per my own generally. This is extraordinary substance for your perusers.

  19. The knowledge you share really changes me in life, I sincerely thank you for the things you have done, sure your blog will help more people. Sincerely thanks

  20. Thanks for this Informative and valuable article

  21. Thank you for giving them this great knowledge, really thank you for sharing, hope you will have such great posts as this more.

  22. There is such a great amount in this article I would never have considered all alone. Your substance gives perusers things to consider in an intriguing way. Much obliged to you for your unmistakable data.

  23. I believe there are many other people who are interested in them just like me! How long does it take to complete this article? I hope you continue to have such quality articles to share with everyone! I believe a lot of people will be surprised to read this article! Thanks for your post!

  24. Thanks for your page! Your share information it helped me alot! I pray for you to be happy and successful in your life. survival games

  25. Thanks for sharing these useful information! This is really interesting information for me.

  26. Thanks for this Informative and valuable article

  27. Thanks for sharing these useful information! This is really interesting information for me.

    Reply

Leave a Reply