I have a simple PHP script that I want to load whenever someone lands on a homepage. It is fetching data from another service and then I have to display it in a container on the homepage.
I was looking at options on how to enable PHP code in an HTML box that is provided by Wordpress.
I found several plugins that claim to enable parsing and execution of PHP scripts inside the HTML box/text-box. However, none of them are working for me. I tried PHP Code Widget in the last and I noticed that somehow my PHP code is automatically converted to HTML comments. See example below --
After activating the plugin, I entered this in the text view (I tried visual view as well) of the HTML box.
<?php echo "Hello World!"; ?>
However, nothing showed up on the page. When I did an inspect element, it showed me something like this --
<div class="htmlbox-content"> <!--?php echo "Hello world!"; ?--> </div>
It had automatically converted the opening bracket of my PHP code to an HTML comment. I tried editing it inline, however whenever I remove the "--", they come back again i.e. it doesn't let me alter them.
I am not 100% sure if I am doing it right. However, I could not find anything wrong in the steps I have been performing. How do I fix this?
Also, I am aware that enabling PHP code in HTML/textbox is not a great solution. However, I could not find anything that points me to how I can achieve the same goal otherwise. Any tutorial/pointers otherwise would be really appreciated!
I am on a network enabled Wordpress 3.9.2
I tried enabling just for the website as well as enabling it across the network. Same result in both scenarios.
The plugin is compatible for versions 2.8 and higher and supported uptil 4.0.1, hence should ideally work. I have also tried other plugins with different variations on what they support, however none of them seem to work.