0

in the book professional wordpress, they use something like

$options = array(
    'classname' => 'pp_widget',
    'description' => '...'
);
$this->WP_Widget('pp_widget', ..., $options);

but in most tutorials

$this->WP_Widget(false, ...

is used. i wonder is there a reason to specify the $id_base param? i see that if i dont, an id will be generated. also, is there any need to specify the classname option?

on a side note, i asked a related question on stack overflow: PHP: parent::somefunction or $this->somefunction if someone got an answer let me know :)

1 Answer 1

1

The reason is simply customization (these values end up in widget's HTML markup). If someone needs to change this stuff (for example to be compatible with some script without adding wrapper layers) the option is there.

As for methods calling - parent:: explicitly calls method from parent class, $this-> calls method from current class. Since widgets do not redefine WP_Widget method there is no practical difference.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.