Can i add a widget on the same position eg "Main area - Top" more than one times?

Post date: 2024-09-18 03:21:19
Views: 3

I am building a new widget and I would like to ask if there is any way programmatically to let admins to add this widget more than one times in the same position. In my case at the position "Main area -Top". How can I achieve this behavior?

I checked the file admin-widgets.php and found this part of code:

$region = $regioncodessubstr($place, 0, 1)];

    $widgetallowed = method_exists($module, 'allow_region') && $module->allow_region($region);

    if ($widgetallowed) {
        foreach ($widgets as $widget) {
            if ($widget'place'] == $place && $widget'title'] == $editwidget'title'] && $widget'widgetid'] !== @$editwidget'widgetid'])
                $widgetallowed = false; // don't allow two instances of same widget in same place
        }
    }


But how can I override this code in my custom widget file as I dont want to modify core files?? I need the $widgetallowed var to be true. -> $widgetallowed = true;

Please click Here to read the full story.
 
Other Top and Latest Questions:
Fed to cut rates by a quarter point with a soft landing expected, according to CNBC Fed Survey
How to invest for the next decade with New York Life's Lauren Goodwin from Future Proof 2024
Shares of Broadcom should be higher given the chipmaker's AI growth outlook
More stocks are participating to the upside, signaling a healthier market
Hezbollah members among hundreds wounded after pagers explode in Lebanon and Syria, officials say
Wine Club membership as wedding present for couple in USA?
All Elite Wrestling: Dynamite: September 18, 2024
Stargate SG-1: Brief Candle
I screwed up my postcards to voters. Can I fix them?
In federal trial, Michael Kors says it's harder to sell handbags in TikTok and Taylor Swift era