__NAMESPACE__ with register_activation_hook

The reason that the plugin activation hook wasn’t working in the code provided in the question is that on plugin activation the plugins_loaded hook is never run. Since the register_activation_hook hook was hooked from plugins_loaded it was never run on activation. And since it’s never fired ever again, this way of hooking results in register_activation_hook … Read more

What is the correct way to build a widget using OOP

You can simply put your init code within the constructor of the class. For example: class myWidget extends WP_Widget{ function myWidget(){ // Init code here } function widget( $args, $instance ) { // The widget code wp_enqueue_script(…); wp_enqueue_style(…); } // Over methods… } register_widget(‘myWidget’); My preference is to actually put the enqueue calls within the … Read more

Using Ajax with a Class file

The errors I’ve spotted in your code: One was pointed by @helgatheviking in a comment: the Ajax callback has to be a public method, not private. Not sure how are you initializing this class, but wp_enqueue_script&_style (in singular) has to be encapsulated inside a wp_enqueue_scripts hook (WP_DEBUG dumps a notice). You can drop the & … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)