I have the following site structure
Parent Site
-> blog (wordpress)
-> get-recent-posts.php
-> index.php
I want to display a list of recent posts in the index.php. I am trying to use wordpress api functions in index.php but it is not working. If i try to directly run get-recent-posts.php it shows the posts but if i include it in index.php it does’nt work.
Adding the following code to the top of the page will do the job. The path should be the absolute or relative path to your wp installation.