I am trying to integrate wordpress
with my previously installed platform.
I was able to edit most of the system as I wish, but I can´t figure out how to intervene in what wordpress
does before loading the template file
.
What I want to add is a simple conditional statement that either load a page trough my previous cms, or loads normally wordpress
.
However, I was unable to understand which function or file loads the components of the theme.
I understand wp
uses template hierarchy, loading different files
for different types of pages (posts, category page, and so on).
But what function
is making this choices and actually loading the files?
Your question isn’t clear enough in what you’re actually trying to do but /wp-includes/template-loader.php is going to be of particular interest to you.
This is the file that loads the templates. Just to make it clear I’m not suggesting you modify this file I’m merely pointing out where the magic happens.
As soon as it’s loaded it runs the action
template_redirect
. If you wanted to perform some logic then redirect here’s where you’d do it. Here’s an example that would go in your theme’s functions.php:At the bottom of this file there are conditionals which determine which template file is: