How is WP_Query parsed to determine which template to request?

The template loader determines which template to load for a given view, there’s a filter available to change this though, template_include as seen on the source page linked.

Moved from comment to answer.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)