My php code is called from the html code in a wordpress page. However It is being commented out by the browser. The code:
<?php if (function_exists (gCF)) gCF(); ?>
inside a div is being read as following (when I see in firebug or chrome)
<!--?php if (function_exists (gCF)) gCF(); ?-->
I searched the net and found following similar questions, but sadly there is no apt solution, and nor has anyone mentioned why this is happening. Is it because of doctype???
Question 1 Question 2 Question 3 Question 4
Thanks in advance.
By default, Wordpress does not support the use of PHP code directly in a post. A simple Google search brought up some possible plugins that could allow you to do this.
It's possible that the file is not being parsed by PHP. Make sure the file extension is PHP or your server is setup to parse that filetype using PHP.
It sounds to me like the code is inside a file that does not have a
.php
extension and therefore the code is being evaluated asHTML
.If you want to use
php
in wordpress, make sure it's in a template file (either an existing one or one that you've made).