Do or do not, there is no try


Birds of prey, also known as raptors, hunt and feed on other animals. The term "raptor" is derived from the Latin word rapere. These birds are characterised by a keen vision that allows them to detect prey during flight and powerful talons and beaks.

  1. maria

    I copy your code and works but I change for my blog and I get message each time:

    Warning: Missing argument 2 for WP_Widget::__construct(), called in wp-includeswidgets.php on line 320 and defined inwp-includeswidgets.php on line 93

    What is not working? Thx

  2. PhilippISN

    You may use the __construct keyword instead of the classname; and also, it is good practice to call the constructer of your super class. I also prefeer to use public/private etc. keywords for the members


    public function __construct()
    parent::__construct('Sample_Widget','Sample Widget',
    array('description' => __('This is the widget description',''),));

    But good article :-) and thanks alot!

  3. Dean

    Excellent post. Thank You.

    I simply created a folder undre plugins folder and copied the php file into there and it worked straight away :-)

    Now hacking it around to build a schools newsboard widget

  4. Jacob

    Great tutorial, easy to follow and use. Then you dont have to invent the deep plate again :-)

    Thank you

  5. Nameless666

    Thank you for you tutorials I find this very useful. you simplicity create the power of your posts
    thank you again for this as work.

  6. Bruno Rico
    Bruno Rico

    Great info. Thanks for updating last post about widgets :)

  7. bitacre

    Thanks so much for your WP plugin tutorial it really helped me get started coding widgets quickly. Just wanted to let you know your site is fantastic and I've put your site in the acknowledgements section of every plugin I've made so far.

    Really great work, thanks again.

  8. Sabin

    Thanks so much for putting this together, this example was tremendously helpful and really allowed me to get a solid foundation to expand from. I will be sure to mention you and your site in every WP plugin I make! Thanks again!

  9. Alan Trulock
    Alan Trulock

    Nice! I followed through this and the previous two tutorials. Very helpful!

  10. Doug E
    Doug E

    This was great man, I finally found something simple enough to deconstruct to make my own widget :D

    On the chance anybody is having the same problem as I, I've been trying to add my own html code somewhere to the widget that is the design to appear on the sidebar of my blog. In this example replace Hello World between the 's with your html. In your html replace the "s with 's

    Mine for example was a div containing a table with some classes and I couldn't figure out where to put this for the final output onto the sidebar.

  11. Chris

    In an ideal world, I'll have time to play with this more!

    Thanks for the help though...

  12. Gerard

    Tim - I'm not sure if you covered it above, but can this code exist within functions.php or does it need to be bundled somewhere else? I'd like to create a widget to display recent posts with thumbnails, and bundle it with the theme I've created. What's the best way to achieve that?

    1. Tim Trott
      Tim Trott

      Hi Gerard,

      When I do this I create the widget as a plugin, then create a widgets folder within the theme folder and include the widget file within functions.php


      Hope that helps

  13. Pavel

    Thank you for this article. It helped me to feel some gaps in my starting knowledge of WP.

  14. randaweb

    I attempted to install this Sample Widget and it fails. I copied the code directly from your post into my file after I entered the info manually (practice). Still, did not work.

    I am using WordPress 3.0.1

    Thank you.

Leave a Reply

Your email address will not be published.