From beabbb07e9829624d2300e6572a9ac9ca906eb92 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Jun 23 2022 16:56:06 +0000 Subject: Make the widgets use non deprecated constructors This way of building a widget was broken when upgraded to php 8, and is deprecated since WP 4.3 See https://discussion.fedoraproject.org/t/upgrade-of-the-blog-to-php-8-0-and-wp-6-0/39618 and https://wordpress.org/support/topic/wp-5-6-rc4-php-8-0-uncaught-argumentcounterror/#post-13755072 --- diff --git a/fedoramagazine/widgets/magazine-postseries-widget.php b/fedoramagazine/widgets/magazine-postseries-widget.php index de1ef5d..54335ac 100644 --- a/fedoramagazine/widgets/magazine-postseries-widget.php +++ b/fedoramagazine/widgets/magazine-postseries-widget.php @@ -1,8 +1,12 @@ __('Displays postseries.', 'rowling') )); + function __construct() { + $widget_ops = array( + 'classname' => 'magazine_postseries_widget', + 'description' => 'Displays postseries.' + ); + parent::__construct( 'magazine_postseries_widget', 'Magazine postseries widget', $widget_ops ); } function widget($args, $instance) { diff --git a/fedoramagazine/widgets/magazine-recent-widget.php b/fedoramagazine/widgets/magazine-recent-widget.php index 0d49e72..2350fe3 100644 --- a/fedoramagazine/widgets/magazine-recent-widget.php +++ b/fedoramagazine/widgets/magazine-recent-widget.php @@ -2,8 +2,12 @@ class magazine_recent_widget extends WP_Widget { - function magazine_recent_widget() { - parent::WP_Widget(false, $name = 'Magazine Recent posts widget', array('description' => __('Displays recent posts.', 'rowling') )); + function __construct() { + $widget_ops = array( + 'classname' => 'magazine_recent_widget', + 'description' => 'Displays recent posts.' + ); + parent::__construct( 'magazine_recent_widget', 'Magazine Recent posts widget', $widget_ops ); } function widget($args, $instance) {