So, you want to include (also include_once, require or require_once) another PHP file in one of your WordPress files?? Fine, but if your PHP file is in a different folder/directory to your WordPress installation you might run into problems.
After spending too long trawling the WordPress Codex trying to find a solution, I luckily found this post by Andy Fletcher – How to use a PHP include with WordPress
ABSPATH is your friend and the answer to your prayers. ? For example, assume your PHP files are in a folder off your web root called “thefolder”, you would include them using:
<?php include(ABSPATH . '/thefolder/thefile.php'); ?>
Simple when you know how.
As a web developer I use a variety of Content Management Systems (CMS), either a bespoke solution I develop myself or more commonly an off the shelf (normally) Open Source platform.
I’ve been using the excellent CMS Made Simple for a couple of years now with great results (don’t let the “simple” in the name fool you, this is a feature-rich application) so when I was asked if I would like to review a copy of CMS Made Simple 1.6: Beginner’s Guide by Sofia Hauschildt I jumped at the chance.
Embarrassingly, I’ve had this copy of the book sitting by my desk for a couple of months but have been so busy with work I’ve not had the chance to flick past the first few pages. However, now I’ve got some new CMSMS projects in the pipeline I’m looking forward to getting into the book and seeing what it can offer. Continue reading “Beginner’s Guide to CMS Made Simple 1.6”