Import Recent Posts Only and Ignore old ones if exist

I'm using MailChimp Campaigns Plugin where it imports all Mailchimp campaigns as a custom post type on the website. The app works perfectly however I'm modifying the process to import recent posts only to avoid any post modification to be overwritten. The import() function works as following: /** * Actually do the import of Mailchimp campaigns. */ public function import() { if ($this->is_error) { return; } $x = 0; $campaigns = $this->getCampaigns(); foreach ($campaigns as $i => $campaign) { try …
Category: Web

}catch (ex){} showing in header

I have this string showing in the header of my site : }catch (ex){} I can see this in the source code : }</style><script>try{ <script id="mcjs">!function(c,h,i,m,p){m=c.createElement(h),p=c.getElementsByTagName(h)[0],m.async=1,m.src=i,p.parentNode.insertBefore(m,p)}(document,"script","https://chimpstatic.com/mcjs-connected/js/users/2095bd42340716fa509260a90/406ca4747992260e47dbadffd.js");</script> }catch (ex){}</script> <style type="text/css" id="wp-custom-css"> @media (max-width: 465px){ .heading-mobile-center{ text-align: center; } Can anyone help ? Thanks.
Category: Web

import mailchimp newsletters into wordpress

We send out a weekly newsletter in Mailchimp, that i'd like to be able to import into Wordpress as a post - much the same as in this thread: Integrating MailChimp newsletters as post I've tried the Mailchimp Campaign Manager mentioned, it's out of date and not working. also tried Chimp Express but it wouldn't connect to Mailchimp with our API key. would welcome any suggestions of how i might make this happen, plugin or otherwise? TIA
Category: Web

Signup Form that adds customer to MailChimp, redirects to checkout, and fills in form data

You can see what I am trying to do on this test page - the top button labelled "MAILCHIMP + CHECKOUT" is what I'm working on. I am trying to accomplish 3 things (at the moment 2 & 3 are working on my test page): Send form data to MailChimp Redirect to checkout Auto-populate the checkout fields with the form data I can use a plugin and make a form that sends data to MailChimp that works fine, but when …
Category: Web

mailchimp integration on a custom footer

I want the user to be able to opt-in to a MailChimp newsletter within a custom footer, which one. of our clients has asked for. The client also uses MailChimp so we therefore cannot use anything like contactform-7 etc The two images below will help explain. The user will type in their email address and will submit the email to subscribe to the newsletter. I repeat this is in a custom footer and I am trying to do this from …
Category: Web

Mailchimp Popup on homepage only with is (front_page)

Trying to get my Mailchimp pop-up to only display on my homepage. Put this code in the site header but still show up on every page. What am I doing wrong? <?php if(!is_front_page() || !is_home()){?> <script id="mcjs">!function(c,h,i,m,p){m=c.createElement(h),p=c.getElementsByTagName(h). [0],m.async=1,m.src=i,p.parentNode.insertBefore(m,p)} (document,"script","https://chimpstatic.com/mcjs- connected/js/users/bb98175c14cd48aeb0879ecff/.....js");</script> <?php }?>
Category: Web

Exporting post info into a formatted table and into MailChimp as automated as possible

This is a complex one, and I'm ok if not every aspect of it can be automated but I'd like to try to get as close as possible. What I'm trying to do: I'm building a job site and I want to be able to send new jobs every week to signed up users through MailChimp (I'll happily consider another email sender if someone recommends one that can achieve what I'm trying to do). I'd like the newsletter/job alert email …
Category: Web

Is there a way to cache mailchimp css on wordpress?

At that point where I'm playing with load times and scores on Lighthouse, GtMetrix and the like, and am seeing problems? where external css scripts aren't being cached. For example, from mailchimp.com: Is there a way to do this locally? With a plugin, preferably? Or is the only way to store a copy of the .css and cache that, every so often checking to see if mailchimp has changed theirs??
Category: Web

MailChimp subscribe popup not displaying but displaying after admin login

I am using MailChimp subscribe popup on my Wordpress website. I am getting one issue. I added the below code on my website. <script type="text/javascript" src="//downloads.mailchimp.com/js/signup-forms/popup/unique-methods/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script> <script type="text/javascript">window.dojoRequire(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us5.list-manage.com","uuid":"e47ee5fe210b931aa5a748840","lid":"2b074a0a8b","uniqueMethods":true}) })</script> I am not getting the popup on my website but if I log in to the WordPress and refresh the page then I am getting the popup. I checked in the console I am getting the error TypeError: window.dojoRequire is not a function
Category: Web

Remove wpautop from shortcode content / remove whitespace in buffering

I am using the Mailchimp plugin, and it has a shortcode that uses output buffering to grab its widget's code and spit it out in the content. However, the widget code has plenty of white space, so the_content filters are throwing useless linebreaks (like after hidden inputs) and empty p tags everywhere... rendering it unusable. I am removing the shortcode to add my own, but I'm not sure what to do to prevent the WordPress wpautop filter from going crazy. …
Category: Web

Integrating MailChimp newsletters as post

I have newsletters from MailChimp I'd like to include as WordPress posts. Trouble is, all the formatting in the MailChimp post makes it difficult to bring into WordPress. Is there any way to do this - what are the options? At this point I've tried a few plugins and various copy-and-paste based methods. I may try just using an iframe in a WordPress post to show the newsletter, but I'm not sure if iframes work in WordPress posts. Part of …
Category: Web

Sending JSON string through wp_remote_post()

I'm building a mailchimp integration and they require a POST call with JSON code. No, I'm using this code that actually works: $data = wp_remote_post($url, array( 'headers' => array('Content-Type' => 'application/json; charset=utf-8'), 'body' => json_encode($array_with_parameters), 'method' => 'POST' )); But, it returns a PHP warning Warning: http_build_query(): Parameter 1 expected to be Array or Object. Incorrect value given in ../wp-includes/Requests/Transport/cURL.php on line 507 How to avoit it? I've tried to just use the plain array in 'body' index but MailChimp …
Category: Web

Looking for a way that will collect visitors emails before letting them view the blog posts

I am looking for a way that will collect visitors emails before letting them view the blog posts. What I want to do is let visitors browse the blog posts, view all categories and browse article titles and summaries - but when they click on a particular blog post and want to view the whole post, I want to require them to enter their email before viewing - NOT a full blown registration with password. I need to store these …
Category: Web

Launching a Mailchimp popup from a menu item

I'm trying to add a menu item that when clicked, will open a Mailchimp popup form. Although I'm familiar with VBA and Access Dev, I have limited knowledge of Web/WordPress Dev. These are the snippets of code I've tried so far based on the research I've done online: 1) I found this one on several different sites. The problem with it is that it seems there isn't any way to get it to launch from a Menu item. <script type="text/javascript" …
Category: Web

Adding Mailchimp subscribe into custom theme

I am creating custom theme and we would to add Mailchimp subscribe form. This is somewhat easy with Mailchimp for Wordpress plugin, but this plugin creates forms with certain ID and there is no possibility for us to pre-determine which form ID will this plugin create so when user installs the theme they will have to change form ID in the actual code and we would like to avoid this. So my question is how to create forms that can …
Category: Web

How to modify the image size in RSS (mailchimp compatibility)?

I am using the following code in my functions.php and it shows the thumbnail properly in my mailchimp's campaign test email ... function dn_add_rss_image() { global $post; $output = ''; if ( has_post_thumbnail( $post->ID ) ) { $thumbnail_ID = get_post_thumbnail_id( $post->ID ); $thumbnail = wp_get_attachment_image_src( $thumbnail_ID, 'thumbnail' ); $output .= '<media:content xmlns:media="http://search.yahoo.com/mrss/" medium="image" type="image/jpeg"'; $output .= ' url="'. $thumbnail[0] .'"'; $output .= ' width="'. $thumbnail[1] .'"'; $output .= ' height="'. $thumbnail[2] .'"'; $output .= ' />'; } echo $output; } …
Category: Web

not logged in users can't submit form

I embedded a Mailchimp newsletter registration using the mailchimp-plugin, which works just fine for logged in users and also on other websites of mine. But on this page, users who are not logged in, can't click the submit button hof the form. It just has no effect and no error message appears. Nothing is happening. EDIT: Could the problem be the fact, that there are two forms on the page, when the user isn't logged in and mailchimp can't figure …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.