Including header and footer to a custom location

Is it possible to include a wordpress header into a php file which is located in folder e.g.: wp-content/uploads/custom.php ?

Related posts

Leave a Reply

1 comment

  1. You can make use of this documentation: Integrating WordPress with your website

    In your case, you can create the file content.php and add this code, I just tried this on my website and it worked:

    <?php 
      $path = $_SERVER['DOCUMENT_ROOT']; // Gets the root directory URL
      $path .= '/domain_dir'; // Appends your WordPress installation URL
      require( dirname($path) . '/wp-blog-header.php'); // Require this to execute get_header();
    
      get_header(); // Executes header.php
    ?>