我在我的子主题根目录中有一个名为image-svg.php的文件
在子文件名/page-template/filexample.php下的另一个文件中
我想包含image-svg.php
我尝试了不同的方法,但没有包含该文件:
<?php get_template_part('africa-map-svg.php'); ?>
<?php include('africa-map-svg.php'); ?>如何包含此文件?
发布于 2019-06-25 22:54:45
您可以使用get_template_directory检索当前主题的目录。
<?php require get_template_directory().'/africa-map-svg.php'; ?>发布于 2019-06-29 18:05:24
你可以使用下面的函数来包含任何文件。get_theme_file_uri()
请试试这个
<?php require_once (get_theme_file_uri('/africa-map-svg.php')); ?>https://stackoverflow.com/questions/56756779
复制相似问题