How to make a php page and use a WordPress theme

I want to create a special php and javascript page, but I want it to use my WordPress theme that is already installed. How to do that?

Thanks

Related posts

Leave a Reply

3 comments

  1. You can do this by including the header and footer from wordpress, and putting your own code in the middle. Such as this:

    include $_SERVER['DOCUMENT_ROOT']."/wp-blog-header.php";
    include $_SERVER['DOCUMENT_ROOT']."/wp-content/themes/[YOUR THEME]/header.php";
    // your code goes here
    include $_SERVER['DOCUMENT_ROOT']."/wp-content/themes/[YOUR THEME]/footer.php";
    

    I haven’t tested this on newer versions of wordpress, but in the past that has worked. You can even include the wpconfig file if you want to use some of those variables, such as the database connection information.

    Hope this helps.