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 }?

Topic plugin-mailchimp Wordpress

Category Web


You have a couple problems. First, the ! in the conditional means "NOT." Secondly, the || means "OR".

In other words, your conditional translates to:

If this is NOT the front page OR this is NOT the post archive page

That describes every page. Try this instead:

<?php if ( is_front_page() ) :?>
    <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 endif; ?>

This says "If this is the front page, output the following code"

About

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