#44344 closed defect (bug) (maybelater)
Extending from WP_Widget_Media_Image not work
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | major | Version: | 4.9.6 |
Component: | Widgets | Keywords: | |
Focuses: | Cc: |
Description
Hi
i am writing widget that just some change in WP_Widget_Media_Image class. so i extends WP_Widget_Media_Image and call 'register_widget()' in 'widgets_init' action.
but id do not see my widget in widgets area.
is that a bug? or not posible in wordpress development?
thanks
Attachments (1)
Change History (5)
#1
follow-up:
↓ 2
@
5 years ago
@hamedmoodi Take a look at the WP_Widget_Media_Image
class's constructor:
Note that it does not pass along any arguments it takes. Maybe this is a bug, but it should be easy to work around. In your constructor, just try setting the class variables manually after calling the parent constructor. For example:
<?php // ... public function __construct() { parent::__construct(); $this->id_base = 'custom_image'; $this->name = __( 'Custom Image', 'custom' ); // ...
#2
in reply to:
↑ 1
@
5 years ago
Thanks. its work. its my fault.
Replying to westonruter:
@hamedmoodi Take a look at the
WP_Widget_Media_Image
class's constructor:
Note that it does not pass along any arguments it takes. Maybe this is a bug, but it should be easy to work around. In your constructor, just try setting the class variables manually after calling the parent constructor. For example:
<?php // ... public function __construct() { parent::__construct(); $this->id_base = 'custom_image'; $this->name = __( 'Custom Image', 'custom' ); // ...
#3
@
5 years ago
- Milestone Awaiting Review deleted
- Resolution set to maybelater
- Status changed from new to closed
#4
@
2 years ago
Hi, I wonder if there is any working example using "extends WP_Widget_Media_Image"?
I need to add some additional fields to the built-in image widget. I followed this thread and https://wordpress.org/support/topic/wp_widget_media_image-new-field/ but still no luck.
Thank you.
Sampe class that extends from WP_Widget_Media_Image