Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Tarik Hamilton
Tarik Hamilton
6,799 Points

Custom Wordpress Theme and Accessing Non-Wordpress PHP Scripts with AJAX

I'm building a website that is using WordPress as the CMS. I have an AJAX script on a page, but I don't know how to reference (or where to store) my PHP script to be called since the URLs don't follow the folder structure. Anyone know how to go about this?

Tarik Hamilton
Tarik Hamilton
6,799 Points

@Zac Gordon: I appreciate the response, Zac. Is that the only way to go about this? I'm building a search engine on top of Wordpress and I just need to run a PHP script. I just want AJAX to pull the data, because the data doesn't load unless I refresh the page. I was hoping I didn't have to watch the whole plug-ins course, and skipping to the AJAX section didn't help.

1 Answer

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Check out our how to build a plugin course. It gets into working with Ajax. You'll just add your code to the functions.php file instead of the plugin file but it should still work pretty much the same.