I was doing some template modifications for a buddy of mine. He created a design concept that required somewhat of a dynamic navigation. So in brief what i want to do is to load the navigation and its content within an AJAX Request from a separate PHP file that echos a well formed HTML, containing the appropriate childs of a certain page.
Now my question is, how to enable the PHP file to access the get_pages() function from WP. When i load my file as a plugin I can use all the native WP classes and functions but the file is executed everytime I open up a new page within the WP application. And since the file needs to have an "echo" in the end, I always have the output on top of everything.
And hints for an Ajax and WP beginner how to solve this scenario?
Thanks a lot!