I am using a custom CMS for a website that deals with 90% of the site's pages and content.
However, for the news/blog section of the site, I am using Wordpress.
I'm able to include the necessary Wordpress files to pull in posts to the main site, but cannot do the reverse.
I want to be able to call a php file into the header of Wordpress so I have access to the CMS's classes, primarily for navigation.
I've tried a search but can't seem to find an answer.
Additional Information:
- Wordpress is installed in
site.com/wordpress
- The file I want to include is in
site.com/includes
Clarification:
I don't want to create a custom template or include Wordpress functionality outside of Wordpress. I want to pull external classes from a CMS, which is a level above Wordpress, into Wordpress so that I can use it throughout the Wordpress installation.
Method 1 :
Method 2 :
You should go with custom page template.
Its an easy way to include php file in wordpress because in thisway you can easily include wordpress theme header and footer.
To create a custom page template.
You have to simply create new .php page and at start of page just include this code.
To read in detail about Wordpress custom page template click here
I hope it will help you.
I managed to fix this by altering the
include
line to reference the folder above the Wordpress root.So, the line became
require_once "../path/to/file"
instead of justrequire_once "/path/to/file"