PHP calling function within a class

You can merge this two json objects via array_merge. But you must decode before to a array. You have this inside your example, below as single source function. This should get the merged json object. A example function, usable for your mix_cat()method. function mergeToJSON( $obj1, $obj2 ) { $json1 = $this->test_cat(); $json2 = $this->test_cat1(); if … Read more

AJAX save options inside class

Found the issue. First I added ini_set(‘log_errors’,TRUE); ini_set(‘error_reporting’, E_ALL); ini_set(‘error_log’, dirname(__FILE__) . ‘/error_log.txt’); along the define(‘WP_DEBUG’, TRUE); in my wp-config.php, this writes the errors, notices and warnings in the error_log.txt in the root folder (I don’t know why I haven’t thought of that in the first place). Then I saw the errors – I used … Read more

Reorganization of namespaces

Ok. Problem solved. I added plugin as i said to manage autoloader and other stuff. I changed my autoloader and thanks to that i have one in place of 3. Solution was to change one piece of directory with plugin name.This is my autoloader now: public function xx_main_plugin( $class ) { $array = explode(‘\\’, $class); … Read more

Cannot access class properties from ajax call in wpordrpess

The problem was caused by another method inside the class: public function create_cart_id() { if( is_user_logged_in() ) { $this->create_logged_in_cart_id(); }else { $this->create_non_logged_in_cart_id(); } return $this->cart_id; – adding that line solved the problem } This method generates the $cart_id, but it didn’t return its value, so it was not accessible from outside and returned null.

Class called in template, AJAX not registering

You can’t hook into AJAX in a template, because the template’s not going to be loaded by admin-ajax.php when the request is made. You need to hook into AJAX when the plugin is loaded. Since your hooks are defined in the class constructor (whether nor not this is a good idea is another issue), you … Read more

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