hcohenwork
Forum Replies Created
-
Resolved via support (class was case sensitive!) – thank you!
- This reply was modified 4 years, 6 months ago by hcohenwork.
Hi Lap, thanks for looking into it.
So currently this is incorporated in my theme’s functions.php – yet the issue persists.
Here’s the thing, I’m calling this via an ajax call post page load, so maybe at that time it’s loading the snippet independent of the required plugin class? (really not sure)
Also previously utilizing
$api = mc4wp('api');
worked just fine. So it’s kind of strange (note not crazy experienced in WordPress backend).On the above basis it looks like functions included in the “mailchimp-for-wp/includes/functions.php” work no problem. So although instantiating a class instance doesn’t seem to work, this does.
Somewhat tempted to create a function within “mailchimp-for-wp/includes/functions.php”, that just instantiates the class and returns it for use:
function mc4wp_get_mailchimp() { return new MC4WP_MailChimp(); }
Though once a update comes out – this will disappear and I don’t think this is the “recommended” approach. Any ideas?
- This reply was modified 4 years, 6 months ago by hcohenwork.
Hi Lap, thanks for the example – attempted to integrate in functions.php – though get hit with a fatal wordpress error
PHP Fatal error: Uncaught Error: Class ‘MC4WP_Mailchimp’ not found in (path)../functions.php:457
Is this class not being included?
Hi any other idea? Or can you please identify the way to add tags for this integration?
Hi Lap, unfortunately this did not work either – currently set to the following:
try { $subscriber = $api->add_list_member( $list_id, array( 'email_address' => $email_address, 'status' => $double_optin ? 'pending' : 'subscribed', 'merge_fields' => array( 'FNAME' => $first_name, ), 'interests' => array( // '8da648139d' => '06af539203' interests['06af539203'] => true ) ));