Run PHP script on a single page/when called by Javascript
-
Hi there!
I am currently transitioning from a massive blob of PHP in my functions.php file into multiple separate PHP scripts, as having everything in functions.php was slowing the site down (obviously).
This works fine, however the scripts are still running on all pages. I need them to only run on a singular page, and the code provided in the FAQ did not work:if ( ! is_page( richlands' ) ) return;
as the scripts do not run (richlands is a slug – do I need the whole link?). Is that the correct format?
Another solution if this is a better way is if I could run it from javascript? But I am not sure how to do thaat, so would need an example.
Thanks in advance!
Elliot
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Run PHP script on a single page/when called by Javascript’ is closed to new replies.