plugins – How do I display PHP file contents on front end of WordPress?


I am working with a third party API for events, the results of the GET request I’ve written are rendered/displayed at this URL (inside the SDK folder):

I need to embed these results into specific pages dynamically, so I’ve used a PHP shortcode embed plugin to allow me to echo the file contents onto the page. I have tested this using:

echo "hello world";

And this displays correctly when using the shortcode. So I have the results of the GET request in the results.php file and the ability to embed PHP directly in the page using a shortcode (rather than creating/editing templates in multiple places).

I am now trying to use: echo file_get_contents or include to render the results.php file onto the page using the following code:

echo file_get_contents("/skiddle-php-sdk-master/demo/result.php");

But I get a file path warning:

Warning: file_get_contents(/skiddle-php-sdk-master/demo/result.php): failed to open stream: No such file or directory in /home/customer/www/ : eval()'d code on line 2

I believe this indicates that for some reason the shortcode plugin is expecting the results.php file to be inside the subdirectory of the plugin which it isn’t and shouldn’t be for obvious reasons.

I’ve tried things like this:


to no avail. Can anyone help me to understand how I can return the content of results.php using this process?

van 7 months 2022-01-08T17:33:39-05:00 0 Answers 0 views 0

Leave an answer