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
Advertisement
Answer
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 ?>