Understanding Core Logic:Template Assignment
-
I am reading through core to understand the logic better and had several questions that are probably easy to answer, but may be useful to other developers as well:
With regards to template file selection/assignment. Why is this done completely separately from the template tag assignments?
In class.wp-query.php it appears that the $query_vars and conditional tags are set. Wouldn’t it be more efficient to determine which template file to load at the time that we process the query vars rather than the big (if (is_something && something_template_exists) use template) that happens in template.php?
Perhaps you could set a query variable that was private (so as not to conflict with the template if passed in the query) allowing us to skip all the steps in template.php?
NOTE: I am not suggesting this is an error or that this hasn’t been evaluated and the best path is what we have now, I just am asking for the logic to understand it better. I’m, sure this has been evaluated and there are undoubtedly reasons why it’s done the way it is. I just wondered how you came to the decision.
Thanks in advance for any information.
P.S. If this is not the correct forum to ask questions of this nature, could someone please point me to the correct forum? I don’t mean to distract or anger anyone, I’m just trying to get better at understanding WP.
- The topic ‘Understanding Core Logic:Template Assignment’ is closed to new replies.