Jump to content
freshbrains

How to add custom php app in wordpress

Recommended Posts

Hey there

I was hoping for some advice please. I have a wordpress website but I want to add a custom php app (library files includes php/js/css and some php code to be pasted in the page) to a specific page. I've read it's not good practice to put the files in root directory and can understand why. The app is only suppose run on a specific page and having it running outside of wp is not where I want to go.  So I'd really like to be able to put the files somewhere else in the wp directory and call the script using the themes functions.php or perhaps  add a custom plugin to achieve this. I'm a bit of a noob and not sure how to do either of these, so any tips would be greatly appreciated.

Thank you

 

Share this post


Link to post
Share on other sites

What are you trying to do?  I'm a PHP tinkerer at best, with a lot of help, but I've been using PHP in WordPress for about a decade.  

If you're talking about creating a plugin, that's a process that's pretty easy to start, but really tying it into your site, you'll need to study up on WordPress' codex and template tags: 

https://codex.wordpress.org/Template_Tags

 

If you're talking about putting information onto certain pages, now you're talking about inserting PHP into a page, which isn't native in WordPress.  I'd get a plugin called PHP Code Snippet by XYZscripts.  It's fantastic, and it allows you to easily use code snippets through your site.  From there, I use INCLUDES to associate PHP files to my WP Pages, and I update the PHP files in any text editor.  

I would recommend checking out the Template Tags no matter what.  You can use them in your PHP files just for simple calls, as a lot of what I do involves referring to items within WP.  

 

 

  • Great Answer 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.