Help adding image upload functionality to widget

I also noticed a typo in the url media-upload.php?type=image&amp&TB_iframe=1. Maybe this is the problem. Also a working example: jQuery( ‘input[id^=my_field]’ ).live( ‘click’, function($) { formfield = $( ‘input[id^=my_image]’, $(this).closest(‘.widget’) ).attr( ‘name’ ); tb_show( ”, ‘media-upload.php?type=image&TB_iframe=1’ ); return false; } );

How to use jQuery on widget admin page

I just had the same issue, which I resolved by changing all my IDs to classes. Remember that widgets can be used multiple times on page, so specifying an ID anywhere increases the likelihood that you’ll have ID duplication (Which will in turn cause jQuery to have a fit).

How Can I Duplicate a Widget?

I had the same Problem with one of my Clients, and found this GREAT soluiton: Duplicate Widget. It comes as a new Widget, but has just one option: choose which Widget it should duplicate, and you also see from where it is duplicated (for easy overview where to change the values of the original Widget). … Read more

Is It Possible to Restore Accidentally Deleted Widgets?

You have to search the wp_options database table for option_name‘s that contains widget. That search results in: Using the values of your backups, you’ll then proceed to restore the option_value of the missing widgets. And also the value of the option of sidebars_widgets. Goes without saying that backing up before doing this modifications is essential.

Override Widget class in plugins with custom plugin

You’re actually quite close to answering your own question. Your plugin would have to start with checking whether the plugin is active (which you can also do with function_exists). The you indeed can use remove_action to make sure functions and classes aren’t activated. This doesn’t mean these functions become undefined. So yes, you will need … Read more

Ban certain widgets from certain sidebars

You are overthinking it. The concept of widgets is designed to be transferable between widget area (AKA sidebars). If a widget is not tranferable it is just not a true wordpress widget. Now creating your own framework of widgets sound like a non pleasant idea. In addition to fighting the wordpress core code, you will … Read more

widget should display post archive by year and on click also by month

I did this for a client and it looked like this: The PHP code: <dl class=”tree-accordion”> <?php $currentyear = date(“Y”); $years = range($currentyear, 1950); foreach($years as $year) { ?> <dt><a href=””><i class=”fa fa-fw fa-plus-square-o” aria-hidden=”true”></i> <?php echo $year; ?></a></dt> <?php $archi = wp_get_archives(‘echo=0&show_post_count=1&type=monthly&year=” . $year); $archi = explode(“</li>’, $archi); $links = array(); foreach($archi as $link) … Read more