How to check if a widget has no title

Nope, there is no way (thank I can think of) to do this cleanly. Handling of output and related parameters is up to the each wdiget’s individual widget() method. There is no generic way to manipulate it. You could maybe get away with filtering widget save or display instances to force it to always have … Read more

Check which registered sidebar a widget is added to

There isn’t a standard way to do it AFAIK in the form() method; here’s a function to do it: function wp158055_get_sidebar_id( $widget ) { foreach ( wp_get_sidebars_widgets() as $sidebar_id => $widget_ids ) { if ( array_search( $widget->id, $widget_ids ) !== false ) return $sidebar_id; } return false; } And call with $this. Note from the … Read more

instance is empty in function widget()

Your widget really has a lot of issues and completely breaks my layout on my back-end widget page. I suggest that you start at the Widget API to learn the proper way how to code a widget Here is a couple of issues I have picked up: Reputable sources should not be suggesting or even … Read more

Change recent posts widget title

I had a similar situation. Add the following code to your functions.php and see if it works for you. function my_widget_title($title, $instance, $id_base) { if ( ‘recent-posts’ == $id_base) { return __(‘New Title’); } else { return $title; } } add_filter ( ‘widget_title’ , ‘my_widget_title’, 10, 3); Note: this will change the title of all … Read more

Widget – Store and update data

You probably want to look at using WordPress Transients as they can handle both the data and the timestamp/expiration. You can also check out The Deal with WordPress Transients by CSS Tricks which has some good info as well.

Converting a WordPress widget to a block

The short answer here is no. Widgets are written in PHP and blocks are written in JavaScript. Beyond that there pretty fundamental differences between the two paradigms in the sense of where they are stored, markup output approaches etc. You could take the approach of a dynamic block where the block is rendered on the … Read more

Need some help understanding widgets

Widgets are contained in sidebars (not 100% correct, but good enough). A sidebar is an area in which placement of widgets can be managed in the admin. Widgets are realy an instance of a widget class and usually you can have several widgets of the same class in the same and different sidebars. You can … Read more

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