0

Hi I was told to put the following code into my footer PHP

<?php echo do_shortcode("[wpgmza id="1"]"); ?>

My acutal code:

<div class="col-lg-8"><?php echo do_shortcode("[wpgmza id="1"]"); ?> </div>

Im getting the following Error:

Your PHP code changes were rolled back due to an error on line 142 of file wp-content/themes/XXXX/footer.php. Please fix and try saving again.

syntax error, unexpected '1' (T_LNUMBER)

Why is this happening when most forums i read say to that following code?

Ryken
  • 3
  • 1

1 Answers1

0

You are not escaping the quotes in the string and so the string itself ends just before the 1.

What your code is seeing

<?php echo do_shortcode("string"1"string"); ?>

To fix you can change it to single quotes.

<?php echo do_shortcode('[wpgmza id="1"]'); ?>

Here is more info on escaping strings https://www.php.net/manual/en/language.types.string.php

Hides
  • 496
  • 1
  • 5
  • 15
  • Thank you, cant believe it is as simple as that *Facepalm* – Ryken Apr 29 '20 at 10:03
  • @Ryken No worries, the simplest things are overlooked in code. Could you check this as the right answer if it helped please. Thanks – Hides Apr 29 '20 at 10:05