首页 > 解决方案 > 链接中的wordpress template_directory - php

问题描述

在 wordpress 中,我尝试使用给定template_directory()的链接语法。

如果我使用根目录的完整路径,它可以工作。

$ptthlider_img_second = '/wp/wp-content/themes/theme_name/inc/img/front_slider/slide2.jpg';

我希望的目标是template_directory用于访问jpg.

$ptthlider_img_first = template_directory() . '/inc/img/front_slider/slide1.jpg';

你有什么结论可以帮助我吗?

谢谢和最好的问候,丹尼斯

标签: phpwordpress

解决方案


使用get_template_directory() get_template_directory 文档


推荐阅读