你必须把你的gallery.php 在同一个主题文件夹中functions.php 驻留。然后在中添加一行functions.php:
get_template_part(\'gallery\',\'\');
它将包括
gallery.php 将文件归档到
functions.php 和
gallery.php 将表现为
functions.php.
所以,你必须记住,functions.php 文件是WordPress和PHP函数的文件。因此,如果没有正确的格式,任何不符合格式的内容都可能会在整个网站中出错functions.php 是任何主题的核心文件。
我认为使用WP_Query() 内部afunctions.php - 但您必须正确设置格式和位置。