Php 如何包含子主题中的文件
我的子主题根目录中有一个名为image-svg.php的文件 在childthemename/page templates/filexample.php下的另一个文件中 我想包括image-svg.php 我尝试了不同的方法,但没有包含该文件:Php 如何包含子主题中的文件,php,wordpress,Php,Wordpress,我的子主题根目录中有一个名为image-svg.php的文件 在childthemename/page templates/filexample.php下的另一个文件中 我想包括image-svg.php 我尝试了不同的方法,但没有包含该文件: <?php get_template_part('africa-map-svg.php'); ?> <?php include('africa-map-svg.php'); ?> 如何包含此文件?您可以使用此文件检索当前主题
<?php get_template_part('africa-map-svg.php'); ?>
<?php include('africa-map-svg.php'); ?>
如何包含此文件?您可以使用此文件检索当前主题的目录
<?php require get_template_directory().'/africa-map-svg.php'; ?>
您可以使用以下函数包含任何文件<代码>获取主题文件uri() 请试试这个
<?php require_once (get_theme_file_uri('/africa-map-svg.php')); ?>
它会断开站点。没有错误。网站刚刚崩溃。删除此代码后的任何html。@deSousa您可能希望使用ini\u集('display\u errors,true)启用错误
以查看正在抛出的错误。您的活动主题是SVG所在的子主题吗?