1

Was just editing a site I'm working on to include the subscription form in the footer.php rather than just the homepage. I made the changes on the local server then moved it to my live environment (dev sub-folder). I didn't see any errors on my localhost, but on the dev site it is showing the following error:

PHP Notice: Use of undefined constant php - assumed 'php' in /home/website-name/public_html/uk-en/dev/wp-content/themes/theme-name/footer.php on line 1

The only thing on line 1 is the opening php tag, see code below from the footer.php file

<?php?>
</div><!-- #main -->
<footer id="colophon" class="site-footer" role="contentinfo">
    <div class="subscribe-form">
        ‪<p>SIGN UP TO OUR EMAIL NEWSLETTER FOR NEWS, OFFERS & EXCITING COMPETITIONS.<p>
    <div class="contact-7-subscribe">           <?php echo do_shortcode( '[contact-form-7 id="4563" title="Newsletter"]' ); ?>      </div>
    </div>
    <div class="site-info">
    
        <div class="socialmedia">
            <a href="https://www.facebook.com/pg/page-name/" target="_blank" class="facebook"></a>
            <a href="https://twitter.com/page-name?lang=en" target="_blank" class="twitter"></a>
            <a href="https://www.instagram.com/page-name/" target="_blank" class="youtube"></a>
        </div>
        <div class="payment_cards">
            <img src="<?=site_url();?>/wp-content/uploads/2017/05/payment_cards.png" alt="payments cards"/>
        </div>
        <?php /* Widgetized sidebar */ if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('footerwidget') ) : ?><?php endif; ?>
    </div><!-- .site-info -->
</footer><!-- #colophon -->
</div><!-- #page -->
<?php wp_footer(); ?>
<?php /* if(get_the_ID() == 5) { ?>
<script type="text/javascript" 
src="//s3.amazonaws.com/downloads.mailchimp.com/js/signup-
forms/popup/embed.js" data-dojo-config="usePlainJson: true, isDebug: false">
</script><script type="text/javascript">require(["mojo/signup-
forms/Loader"], function(L) { L.start({"baseUrl":"mc.us10.list-
manage.com","uuid":"37710aefba71598269bda7def","lid":"4385b1c355"}) })
</script>
<?php } */ ?>
<!--Start of Zopim Live Chat Script-->
<script type="text/javascript">
window.$zopim||(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s=
d.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set.
_.push(o)};z._=[];z.set._=[];$.async=!0;$.setAttribute("charset","utf-8");
$.src="//v2.zopim.com/?34qd49wmFaK3NsxoUst4PCSk4gaXUQVe";z.t=+new Date;$.
type="text/javascript";e.parentNode.insertBefore($,e)})(document,"script");
</script>
<!--End of Zopim Live Chat Script--> 
<?php /*?><script type="text/javascript" 
src="//s3.amazonaws.com/downloads.mailchimp.com/js/signup-
forms/popup/embed.js" data-dojo-config="usePlainJson: true, isDebug: false">
</script><script type="text/javascript">require(["mojo/signup-
forms/Loader"], function(L) { L.start({"baseUrl":"mc.us10.list-
manage.com","uuid":"37710aefba71598269bda7def","lid":"4385b1c355"}) })
</script><?php */?>
</body>
</html>

I could turn off notice display however I would like to get the right solution rather than a cover up

5
  • I don't think the file you're showing above matches reality. Can you actually download the file from the live site and compare it to your local one? Commented Dec 8, 2017 at 3:01
  • i've changed the theme name to theme-name and changed the links to hide the identity of the site as it is a client site but besides that everything has been copied exactly from the file. the localhost footer.php file is the same as on the live site because that is what i uploaded Commented Dec 8, 2017 at 3:04
  • Are you totally sure of that? Sometimes files get altered by web hosts after they're uploaded Commented Dec 8, 2017 at 3:06
  • yes you were right. I did not know that. I have updated the code in the question as it is on the live site. I assumed the issue was with the opening php tag closing on the same line, so I have changed the first line to <?php /*opening tag*/ ?> and it seems to have fixed the problem, is the best way around it? Commented Dec 8, 2017 at 3:14
  • @Areej yes that should fix. Or else you can remove the tag altogether if it has no use. Commented Dec 8, 2017 at 4:04

1 Answer 1

6

Basic syntax of php opening tag is <?php[whitespace] not just <?php, see here http://php.net/manual/en/language.basic-syntax.phptags.php#118827. So the right syntax would be adding a white space in between php opening and closing tag <?php ?>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.