How Add custom sidebar widget in wordpress

Hello Everyone!
Hope All are doing well.

If anyone who want create/register own custom sidebar widget then follow these steps

Add following code in your function.php file

 * //Register Testimonies widget 
 * */

class Testimonies_widget extends WP_Widget {
        // Constructor
        function Testimonies_widget() {
            $widget_ops = array('description' => __('Displays one random Testimonies in your sidebar', 'Testimonies'));
            $this->WP_Widget('Testimonies', __('Testimonies'), $widget_ops);

        // Display Widget
        function widget($args, $instance) {
            $title = esc_attr($instance['title']);

            echo $before_widget.$before_title.$title.$after_title;


            echo $after_widget;

        // When Widget Control Form Is Posted
        function update($new_instance, $old_instance) {
            if (!isset($new_instance['submit'])) {
                return false;
            $instance = $old_instance;
            $instance['title'] = strip_tags($new_instance['title']);
            return $instance;

        // DIsplay Widget Control Form
        function form($instance) {
            global $wpdb;
            $instance = wp_parse_args((array) $instance, array('title' => __('Testimonies', 'Testimonies')));
            $title = esc_attr($instance['title']);

    <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'Testimonies'); ?>
    <input id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label>

    <input type="hidden" id="<?php echo $this->get_field_id('submit'); ?>" name="<?php echo $this->get_field_name('submit'); ?>" value="1" />

    ### Function: Init Testimonies  Widget
    add_action('widgets_init', 'widget_Testimonies_init');
    function widget_Testimonies_init() {

function Testimonies_widgetrandom() {
echo "hello raghunath Testimonies";

Sr. Software Engineer

Posted in Wordpress
39 comments on “How Add custom sidebar widget in wordpress
  1. Do you mind if I quote a couple of your posts as long as I provide credit and sources
    back to your site? My blog is in the exact same area of interest
    as yours and my users would certainly benefit from some of the information you present here.
    Please let me know if this ok with you. Cheers!

  2. certainly like your web site however you have to check the spelling on quite a few
    of your posts. A number of them are rife with spelling problems and
    I to find it very bothersome to inform the truth nevertheless I will
    definitely come again again.

  3. Very informative. I can’t believe it took me so in length to obtain this excellent blog. Carry on the good work.

  4. Amazing blog! Is your theme custom made or did you download it from somewhere?
    A design like yours with a few simple tweeks would really
    make my blog stand out. Please let me know where you got
    your design. Cheers

  5. Thanks for your personal marvelous posting! I truly enjoyed reading it, you can be a great author.
    I will be sure to bookmark your blog and definitely will come back in the foreseeable future.
    I want to encourage yourself to continue your great writing, have a
    nice evening!

  6. I get pleasure from, lead to I found just what
    I used to be taking a look for. You’ve ended my 4 day lengthy hunt! God Bless you man. Have a great day. Bye

  7. bookmarked!!, I love your blog!

  8. Thanks a bunch for sharing this with all of us you
    actually know what you are speaking about! Bookmarked.

    Please additionally consult with my site =).
    We can have a link exchange agreement among us

  9. Hi there, There’s no doubt that your web site could be having web browser compatibility problems. When I take a look at your site in Safari, it looks fine however, if opening in IE, it’s got some overlapping issues.
    I simply wanted to give you a quick heads up! Other than that,
    great blog!

  10. Everything is very open with a clear description of the challenges.
    It was definitely informative. Your website is very useful.
    Thanks for sharing!

  11. I have been exploring for a little bit for any high-quality articles or blog posts on this kind of
    house . Exploring in Yahoo I at last stumbled upon this site.

    Studying this information So i’m happy to convey that I have a very just right uncanny feeling I came upon exactly what I needed. I so much definitely will make certain to don?t overlook this web site and give it a glance on a constant basis.

  12. Hi, I do believe this is a great blog. I stumbledupon it 😉
    I may come back once again since i have bookmarked it.
    Money and freedom is the greatest way to change, may you be rich and continue to help other

  13. Hello everybody, here every one is sharing these experience,
    therefore it’s pleasant to read this webpage, and I used to visit this webpage all the time.

  14. bookmarked!!, I love your blog!

  15. Hi, i think that i saw you visited my web site so i came to “return the favor”.
    I am trying to find things to improve my web site!

    I suppose its ok to use some of your ideas!!

  16. Google says:

    here are some links to sites that we link to mainly because we feel they are worth visiting

  17. If some one wants expert view regarding blogging afterward i suggest him/her to pay a visit this weblog, Keep up the pleasant work.

  18. Google says:

    The information and facts talked about in the write-up are a number of the most effective accessible

  19. hello there and thank you for your information – I’ve certainly picked up anything new from right here. I did however expertise several technical issues using this web site, since I experienced to reload the website many times previous to I could get it to load properly. I had been wondering if your hosting is OK? Not that I’m complaining, but sluggish loading
    instances times will very frequently affect your placement in
    google and could damage your quality score if advertising and marketing with
    Adwords. Well I am adding this RSS to my e-mail and could look out for a lot more of your respective intriguing content.
    Ensure that you update this again very soon.

    • Raghunath (Web Freelancer) says:

      Your Most Welcome for come on and visit my blog.My site is working. i have still not received any complain about my site speed.
      So please check this from your end, maybe some internet speed problem on your end.

      Anyway thanks for suggest.

  20. Every weekend i used to visit this site, for the reason that
    i wish for enjoyment, for the reason that this this web site conations in fact fastidious funny
    material too.

  21. Hello There. I found your weblog the usage of msn. This is
    an extremely smartly written article. I will be sure to bookmark
    it and come back to learn extra of your helpful information.
    Thank you for the post. I’ll definitely return.

  22. I am sure this paragraph has touched all the internet viewers, its really really fastidious paragraph on building up
    new web site.

  23. Analisa says:

    hello!,I really like your writing so much!
    share we communicate extra approximately your post on
    AOL? I need a specialist in this area to solve
    my problem. May be that’s you! Having a look ahead to peer you.

    • Raghunath (Web Freelancer) says:

      Your Most Welcome! Analisa and thaks for visit my blog

      Let me know if you want something extra more help from me

  24. says:

    Hi, Neat post. There is an issue together with your site in web explorer, might test this?
    IE still is the market chief and a large section of
    other folks will omit your fantastic writing due to this problem.

  25. Estella says:

    Heya i’m for the first time here. I found this board and I find It really
    useful & it helped me out a lot. I hope to give something back and aid
    others like you aided me.

  26. Jayme says:

    Thanks for any other informative web site. Where else
    could I am getting that type of info written in such an ideal
    method? I’ve a venture that I’m just now operating on, and I’ve been on the look out for such information.

  27. Alberta says:

    Asking questions are actually pleasant thing if you
    are not understanding anything entirely, however this paragraph
    offers good understanding yet.

  28. Milla says:

    I am regular reader, how are you everybody?
    This piece of writing posted at this web page is truly fastidious.

  29. Mathew says:

    Keep on writing, great job!

  30. Kiera says:

    Hi there i am kavin, its my first time to commenting anyplace, when i read this post
    i thought i could also create comment due to this brilliant post.

  31. Beryl says:

    I’m gone to say to my little brother, that he should also pay a visit this blog on regular basis to obtain updated from most recent news update.

  32. Hassie says:

    I do not even know hhow I ended up here, but I thought this post was great.
    I don’t know who youu are buut definitely
    you’re going too a famous blogger if you aren’t already ;
    ) Cheers!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Recent Posts
%d bloggers like this: