I'm trying to call a method into a function widget. The $this
of the widget is passed to that method, but I get the following error:
Strict Standards: Non-static method class_name::method_name() should not be called statically, assuming $this from incompatible context in C:\xampp\htdocs\wp\wp-content\themes\...... on line 446
Here's what I'm trying to do exactly.
The widget form function:
class new_widget extends WP_Widget {
function form($instance) {
<?php widget_fields::input($instance, 'title'); ?>
}
}
And the class which I'm using out of the score of the widget class:
class widget_fields {
function input($t, $slug) {
?>
<p>
<input type="text" name="<?php echo $this->get_field_name($slug); ?>" value="<?php echo $t[$slug]; ?>" />
</p>
<?php
}
}
function form($instance)
from it. I wanted to show that I'm trying to add a form input through a class. The issue is just with using$this
(of the widget) outside it.$this
out of scope of the widget class without getting an error?