# Templating Service

The templating service is the only service that does NOT use a handler. That might change in the future if we decide to support different templating systems like Twig, but for now we only plan to support WordPress' templating system for the time being.

It's a smart wrapper around WordPress' own `locate_template` and `load_template` functions inspired by WooCommerce's own methods for this purpose. There are 5 public methods:

* `load_template_part` - for loading parts of a larger template file
* `load_template` - for loading a whole template file
* `locate_template` - for figuring out which template was used; theme overrides take priority to the plugin's default files
* `get_template_html` - for returning the HTML content of a template file as string
* `get_template_part_html` - for returning the HTML content of a template part file as string

This service is supposed to offer an easy way to support WordPress best practices when it comes to loading template files. That means giving first priority to the child theme, and then to the template theme, before loading the plugin's bundled file and providing enough hooks all around for extending the service.

If you're new to WP templating, we recommend you [read the Codex](https://codex.wordpress.org/Templates) for more information. Of particular interest is [this article about the template hierarchy](https://developer.wordpress.org/themes/basics/template-hierarchy/).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://framework.deep-web-solutions.com/utilities-module/templating-service.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
