Extend WordPress 3.8 Site Activity Dashboard Widget to include more comments

Seems like there is no filter for this (yet), but you can unregister the default activity widget and register (within your functions, or even better within your plugin as recommended by Dave Warfel) a similar activity widget with your custom settings: // unregister the default activity widget add_action(‘wp_dashboard_setup’, ‘remove_dashboard_widgets’ ); function remove_dashboard_widgets() { global $wp_meta_boxes; … Read more

dynamically add scripts to WP_Widget widget() method

I’m plucking this code out of my Total Widget Control plugin, so it might throw an error or two. I dunno, just let me know if it does. This is basically the widget code that I use for everything that I build. if (!function_exists(“register_multiwidget”)): /** * Register a widget * * @param $widget */ function … Read more

Simple rich text editor in Text widget?

I’ve never found one that was reliable and/or not a huge resource/memory drain. 🙁 I ended up using the very handy “Page in Widget” plugin instead – it has the advantage of all the functionality of a regular editable page and your widget content won’t accidentally get wiped, which has happened to me far too … Read more

How to edit widgets in WordPress

The WordPress Widgets API is how various widgets are created and sidebars registered. When creating a new widget there are variables that can be added to any widget. Those get their value from the register_sidebars arguments. args (string/array) (optional) Builds Sidebar based off of ‘name’ and ‘id’ values. Default: None name – Sidebar name. id … Read more

What is the correct way to build a widget using OOP

You can simply put your init code within the constructor of the class. For example: class myWidget extends WP_Widget{ function myWidget(){ // Init code here } function widget( $args, $instance ) { // The widget code wp_enqueue_script(…); wp_enqueue_style(…); } // Over methods… } register_widget(‘myWidget’); My preference is to actually put the enqueue calls within the … Read more

Sharing Dynamic Sidebars across Multisite Blogs

Unfortunately, the switch_to_blog() method isn’t going to work for this purpose. switch_to_blog() is really only a partial switch – it makes some modifications to $wpdb that help with database queries. But it’s not a complete switch in the way you might imagine. In particular, dynamic_sidebar() depends on global called $wp_registered_sidebars. This global is populated by … Read more

Using wp_category_checklist in a widget

The problem is that to make the update method of widget class work, the name inputs on the form method should be set via $this->get_get_field_name(‘name_of_the_field’); but wp_category_checklist has no argument to setup the name of the inputs (checkboxes). However, wp_category_checklist uses a walker class to print the checkboxes and allow customizing it. By default the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)