0

I have several lines of code in my widgets.php that are showing an error.

This is a sample of the code I found at the given location and error:

function asp_testimonail_rotator_widget() {
    parent::__construct( false, 'ASP: Random Testimonial' );
}

I saw a previous thread that solved the error by adding the "_construct", but my code already has it in there. How do I go about fixing that?

Thanks!

  • where is your class definition? and parent class definition? – Alex Jan 02 '19 at 20:32
  • 1
    The class has a method that is named the same as the class itself. You'll need to rename that method. – Alex Howansky Jan 02 '19 at 20:39
  • As Alex pointed out it is not enough to add properly named constructor, you need to remove/rename the old constructor too. – Dharman Jan 02 '19 at 20:42
  • 1
    @AlexHowansky I would rather guess that the class itself is named `asp_testimonail_rotator_widget`, so the problem would be in this class. – Arjan Jan 02 '19 at 20:43
  • Possible duplicate of [Use of deprecated PHP4 style class constructor is not supported since PHP 7](https://stackoverflow.com/questions/50784934/use-of-deprecated-php4-style-class-constructor-is-not-supported-since-php-7) – Dharman Jan 02 '19 at 20:43
  • @Arjan Heh yep came to the same conclusion and had already updated my comment to remove "parent" from it. – Alex Howansky Jan 02 '19 at 20:51
  • Also note, testimonail is spelled testimonial. (Now picturing what a testimonail is -- some sort of test to ensure your toes only have one covering? Or maybe a QA procedure to ensure you have enough wood fasteners.) – Alex Howansky Jan 02 '19 at 20:52
  • Sorry, trying to clean up someone's code. The start of the code for one section looks like this: class asp_testimonail_rotator_widget extends WP_Widget { function __construct() { parent::__construct( false, 'ASP: Random Testimonial' ); } function widget( $args, $instance ) { extract( $args ); $title = apply_filters('widget_title', $instance['title'] ); $testimonial_category_id = apply_filters('widget_title', $instance['category'] ); global $wpdb; global $wp_query; $post_obj = $wp_query->get_queried_object(); $parent_page_id = $post_obj->post_parent; – Aspen Heights Jan 02 '19 at 20:56
  • I updated the function to "function __construct()" and while no error reports occur now... it still think things are not working correctly – Aspen Heights Jan 02 '19 at 20:59
  • How would y'all recommend remaining it? – Aspen Heights Jan 02 '19 at 21:01

0 Answers0