• georgebrianb

    (@georgebrianb)


    Hello,

    I am trying to add php code but it asks me to escape the characters used.. adding <script> tags works, but adding <?php //content here ?> is not working..

    I am trying to do something like this at least:

    <?php echo "Hello World" ?>

    Here’s an example

    Also, I don’t know how to run both PHP and JS in the same script? Or in the body at the same time.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I am having the same problem with exactly the same error report when trying to add code to the footer. I tried replacing < with < and > with > and the plugin editor seemed to like it, however when I clicked the save button it replaced the ampersand codes with the original characters. However it did save the code, but when you look at the page the php snippet did not do anything. I was trying to produce a copyright notice using PHP to insert the current year. It looks like this: “<p>&copy 2014 – <?php echo date(‘Y’); ?> mysite.org</p>” — trying to produce “copyright 2014 – 2022”. Needless to say, it is important to be able to insert PHP scripts.

    Oops this editor did the same thing, i.e. it replaced the ampersand-lt; and ampersand-gt; with the two characters. The sentence with <‘s and >’s doesn’t make sense for this reason. Obviously my attempt to use html character encoding is not helpful.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to add php code?’ is closed to new replies.