I'd like to be able to register multiple copies of the Quick Search Widget in the code below, so that I can have it multiple sidebars. The code has been taken from a plugin I've downloaded

function quickSearchwidgetform()


  include(WP_DSP_ABSPATH . 'wp_search_wiget_form.php');


function widget_dspquicksearch($args) {


  echo $before_widget;

  echo $before_title;?>
Quick Search<?php echo $after_title;


  echo $after_widget;


function dspquicksearch_init()



    'dsp_quick_search_widget',        // your unique widget id

    'Quick Search Widget',          // widget name

    'widget_dspquicksearch',  // callback function

    array(                  // options

        'description' => 'A Quick Search widget that displays dsp dating quick Search form.'




add_action("plugins_loaded", "dspquicksearch_init");

Now I've read in the codex that the new updated method of registering a widget, should be done by register_widget() - however, when I update the code below to use this, the widgets page in my admin screen goes completely white.

Admittedly I may be out of my depth here, but am keen to learn how to fix this. Any tips would be greatly appreciated.

Thank you

1 Answer 1


You really need to be using the Widget API.

Here is a widget shell to get you started.

class WPSE_Widget_Shell extends WP_Widget {

  function __construct() {
    $opts = array(
      'description' => 'Brief description; shows on the backend'
      'Widget Name', // shows on the backend

  function form($instance) {
    echo 'backend widget form (optional if you have not user configurable options)';

  function update($new_instance,$old_instance) {
    // Process backend form data
    // optional if you don't have a 'form' method

  function widget($args,$instance) {
    echo 'Front end widget display';

function register_my_widgets() {

You are extending the widget class at wp-includes/widgets.php so it is good to keep an eye on the parent class. You can use the default widgets as patterns.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.