Using WP core functions in a theme’s folder subfolder

I’m working with a client who needs a customer contract signing system (made in plain PHP and Stripe). They have a WP site and want it integrated into their website at ``. I created a subfolder in the theme’s folder (named `sign` and now it lets me access it through that URL and loads index.php) and now want to save a generated PDF somewhere in the dashboard. I’m trying to search how to do so and additionally guessing whether WP will see any of its core functions used from within that folder.

Maybe I should change my approach? Would like to hear your opinions.

  1. What’s the end goal? Is this to firstly present a customer with a document then the customer digitally signs it, hits a button and the action of doing so creates another file that is then related to the customer?

    Like DocuSign(although that is a huge system and very expensive).

    Before you get to this stage you will need to think about Data Protection and how you are handling that. I’m not sure about anywhere else but in the UK the DP laws are very clear and you need to be up front and make sure you’re handling the information correctly. If for any reason your site is compromised and the attackers gets these signed documents what is the damage that could be caused?

    Creating a folder at the theme level seems a little light to me, at the least you will have to make sure the site is secured with SSL but further to that i would be expecting a level of encryption on the files themselves that makes sure only the DataSubject (the customer) and Data Processor (You) can access.

    THere will almost certainly be a plugin to do this for you, which may negate the need for any custom PHP but i’d expect you might be looking at a fee for this to the developer / service.

    I’ll follow this as it’s something i have an interest in also.

  2. USE A SUBTHEME! Your code might get overwriitten if the author of your theme issues an update.

    Do I have it right believing that your index.php file is a standalone php program, and doesn’t load the WordPress environment? IF that’s the case then you may want to have your code use the media REST API to upload the pdf as an item of media. Once that has happened it will appear under Media.

    But if this project were mine I’d put the code in a custom plugin and use the appropriate WordPress function calls to do this. The custom plugin is a way for your code to be installable independent of your customer’s theme. Custom plugins can be super simple, they don’t have to go through all the coding standards of published themes. Crib offa hellodolly.php to see how simple.


This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer