Make WordPress widget available without plugin but from functions.php

Desperately trying to enable a widget from functions.php file…
When I use it as plugin the widget is available in widgets page and can be included in any widget area.

I want it to show up in the widgets page by itself, without using a plugin for it.
How can I register this widget from functions.php, don’t want a static position but user must be able to drag and drop it to a widget area from the widgets page.

Read More

Any help = highly appreciated!

function quokka_sidebar_tagcloud($args) {
  extract($args);
  echo $before_widget;

    quokka_tag_cloud('sidebar-tagcloud');   
 echo '<br class="clear" />';
echo $after_widget;

}

function quokka_sidebar_tagcloud_init()
{
  register_sidebar_widget(__('Quokka: Sidebar Tagcloud'), 'quokka_sidebar_tagcloud');
}
add_action("plugins_loaded", "quokka_sidebar_tagcloud_init");

Related posts

Leave a Reply

1 comment

  1. Try calling

    add_action("plugins_loaded", "quokka_sidebar_tagcloud_init");
    

    in init and not in “plugins_loaded”. Like this

    add_action("init", "quokka_sidebar_tagcloud_init");
    

    Also this snippet of code is not inside any block or function in the functions.php file right?