Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have multiple sidebars, based on different pages. How can I get the WP125 widget to show on all of them?? Once I add it to one sidebar, it is unavailable to put on others (like many other widgets by the way).

Just to clarify, just multiple instances of the widget with the same content. In other words, the same widget but on more than one page (with different sidebars)

Below the registration function:

//Create Widget
function wp125_create_ad_widget() {
        register_sidebar_widget(__('WP125'), 'wp125_write_ads_widget');
}

Below the line I added to see if another widget is created in the widget area:

        register_sidebar_widget(__('WP125-2'), 'wp125_write_ads_widget'); //nothing happens with this line added.

The rest of the wp125.php file:

function wp125_write_ads_widget($args) {
        extract($args);
        echo $before_widget;
        if (get_option("wp125_widget_title")!='') {
                echo "\n".$before_title; echo get_option("wp125_widget_title"); echo $after_title;
        }
        wp125_write_ads();
        echo $after_widget;
}
share|improve this question
    
I think you might be after The Widget(the_widget()) –  t31os Feb 28 '11 at 19:37
    
I am not sure I follow how to use the_widget(the_widget()). could you include an answer with more detail for my benefit? Thanks. –  Geo Mar 2 '11 at 12:53
add comment

2 Answers 2

You have two options:

Create the widget yourself with the "new" widget api as a class an it will be multiple instance widget.

Or find the line that registers the widget and register the same widget with a new name for example find:

register_sidebar_widget(array('Content License', 'widgets'), 'widget_cc');

and replace with:

register_sidebar_widget(array('Content License 1', 'widgets'), 'widget_cc');
register_sidebar_widget(array('Content License 2', 'widgets'), 'widget_cc');
register_sidebar_widget(array('Content License 3', 'widgets'), 'widget_cc');
register_sidebar_widget(array('Content License 4', 'widgets'), 'widget_cc');
share|improve this answer
    
See my comments, I tried your suggestion, but nothing happened on the widget area. –  Geo Feb 27 '11 at 17:22
    
first you should use wp_register_sidebar_widget instead of register_sidebar_widget i was showing an example, second once you do use wp_register_sidebar_widget give it a different id and name each time you register it. read more about wp_register_sidebar_widget codex.wordpress.org/Function_Reference/… –  Bainternet Feb 27 '11 at 18:13
add comment

//Create Widget
function wp125_create_ad_widget() {
register_sidebar_widget(__('WP125'), 'wp125_write_ads_widget');
}

replace the above function with the below function,

//Create Widget
function wp125_create_ad_widget() {
wp_register_sidebar_widget(__('WP125 1'),'WP125', 'wp125_write_ads_widget');
wp_register_sidebar_widget(__('WP125 2'),'WP125', 'wp125_write_ads_widget');
}

its work for me, wish its help you.

share|improve this answer
    
Please explain that. –  toscho Nov 4 '12 at 0:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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