如何基于子域url进行get_template_part()()

【如何基于子域url进行get_template_part()()】因此, 我为网站制作了一些白色标签, 它们位于服务器上的不同子域中。
我想知道是否可以基于子域获得模板部分, 如下所示:

if (subdomain = 'something') { get_template_part('template-part', 'header_test'); }

我一直在搜索onine一段时间, 没有太多信息。
#1对于此示例, 我们有两个域:
http://www.example.com http://subdomain.example.com

要将不同的模板用于子域, 我们可以通过以下步骤完成此操作:
1)设置子域以指向服务器上的其他目录:
Domain: /home/wherever/public_html Sub-domain: /home/wherever/public_html_subdomain

2)将index.php文件复制到新的子域目录中, 并更新CRAFT_TEMPLATES_PATH变量以指向要使用模板的位置。在此示例中, 两个模板文件夹均位于Web根上方。
// index.php for domain define('CRAFT_TEMPLATES_PATH', realpath(dirname(__FILE__) . "/../templates").'/'); // index.php for subdomain define('CRAFT_TEMPLATES_PATH', realpath(dirname(__FILE__) . "/../templates_subdomain").'/');

现在, 你的模板文件夹如下所示:
/home/wherever/public_html /home/wherever/public_html_subdomain /home/wherever/templates /home/wherever/templates_subdomain

    推荐阅读