display a widget on specific category and its sub categories

you can test category identifier and parent in a widget with that : class WidgetExample extends \WP_Widget { public const IDENTIFIANT = “example1”; public const CATEGORY_ID = 25; public function __construct() { parent::__construct( self::IDENTIFIANT , “Example” ); } public function widget($args, $instance) { if (!is_category()) { return; } $currentCategory = get_queried_object(); if ( (self::CATEGORY_ID !== … Read more

Search transients through widget

A. This is a good idea in general? I’m quite new to transients. No, not really. If your data is for display and search then it’s not really ‘transient’, is it? You should store the data properly in a more permanent place and periodically sync it. If the data from this API makes sense as … Read more

How Migrate a Legacy Widget to block?

TLDR: If you wanted to update to v5.8 you don’t need to do anything to make widgets work, they won’t break if you update. There is no conversion step, no updating of code to make it work. migration is not necessary. I’m trying to tranform legacy widgets to block, I was reading the docs, but … Read more

jQuery Click event is not fired at all

I Found the answer for my question , And I’m sharing it here in case anyone interested. the problem was that click event won’t work on dynamically generated html elements and the alternative that worked is using on $(‘body’).on(‘click’,’#elementID’,Callback)

Remove links from meta widget

There are 2 things you can do here. If you do not want to touch the source code, install any meta widget plugin editor (example – https://wordpress.org/plugins/custom-meta-widget/) and make required changes. If you can access your code, then look for default-widget.php file, find the lines where you have the unnecessary links, delete them and save … Read more