Timeline for How do I create Widget within plugin that uses its own class?
Current License: CC BY-SA 3.0
13 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 4, 2018 at 20:39 | answer | added | T.Todua | timeline score: 0 | |
Oct 22, 2012 at 6:33 | vote | accept | Dameer | ||
Oct 19, 2012 at 21:22 | answer | added | fred2 | timeline score: 0 | |
Oct 18, 2012 at 6:33 | comment | added | Dameer | That's correct man, thanks a lot! It looks like WP_Widget is fired too early. | |
Oct 17, 2012 at 12:33 | comment | added | bueltge |
On which hook do you include the class of your plugin? The best way is plugins_loaded . maybe you create a new instance via new Your_Class and this is to early for the class WP_Widget .
|
|
Oct 17, 2012 at 11:30 | comment | added | Dameer | I have edit my question in order to make it as clear as possible. | |
Oct 17, 2012 at 11:29 | history | edited | Dameer | CC BY-SA 3.0 |
added 114 characters in body
|
Oct 17, 2012 at 11:26 | comment | added | Dameer | @toscho - I have "my-plugin.php" that is main plugin file packed as a class. I'm trying to include additional file (require_once( 'include/custom_functions.php' );) that holds widget class and add_action. External file is included out of plugin class. | |
Oct 17, 2012 at 11:24 | comment | added | Mridul Aggarwal | Just put the widget class before/after your plugin's main class or in a seperate file & then include it in plugin's main file. It should work without a problem | |
Oct 17, 2012 at 11:21 | comment | added | Dameer | @MridulAggarwal - I know I can't put one class into another, I'm trying to pack widgets along with a plugin. | |
Oct 17, 2012 at 11:10 | comment | added | fuxia♦ |
By default the class WP_Widget is loaded earlier than any plugin. Does your widget file run in a WordPress context, or do you call it directly?
|
|
Oct 17, 2012 at 11:07 | comment | added | Mridul Aggarwal | could you explain what you mean? If you're putting one class inside another class, you can't do that in php | |
Oct 17, 2012 at 10:46 | history | asked | Dameer | CC BY-SA 3.0 |