Support » Plugins » Starting with widgets: Hello World doesn’t work

  • Hi,

    I have taken the widgets documentation and created a widget based on the instructions. I simply cut and pasted the hello world example off the page and into a file (adding the proper php code start and endings) and nothing happens. No widget show s up in the admin nor in the sidebar. What am I doing wrong? Here is the code:

    function widget_1($args) {
    <?php echo $before_widget; ?>
    <?php echo $before_title . ‘My Unique Widget’ . $after_title; ?>
    Hello, World!
    <?php echo $after_widget; ?>
    register_sidebar_widget(‘My Unique Widget’, ‘widget_1’);

Viewing 9 replies - 1 through 9 (of 9 total)
  • did you install the widgets code (not your widgets but the widgets engine itself)?


    Thanks for your reply. Yes, other widgets work fine as the widgets plugin is installed. I’m sure its something very minor that I’m missing.

    Anyone have any thoughts?

    A couple.

    1. Widgets are in fact just plugin files. Have you set up your test widget as a plugin?

    2. I don’t feel the example material covers enough. I’d suggest looking over the Google and widget plugins for the best representation of what’s required here.

    I will look over those plugins carefully. I guess I just thought that the hello world example would echo ‘hello world’. Both the google and delicious plugins do a lot, but a simple example is nice too. Thanks for your reply, I appreciate it.

    I agree on the ‘simple’ example. There’s nothing like a Hello Dolly sort of plugin to help one understand the basics, and the same goes for widgets.

    OK, because I’m a giver…

    My Widget – example sidebar widget plugin:
    download widget | view source

    It’s even useful as is!


    Excellent m8 very useful thanks for taking the time

    Kafkaesqui, thank you for your generosity for sharing the above code. I appreciate it very much.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Starting with widgets: Hello World doesn’t work’ is closed to new replies.