我正在使用get_template_part从其他文件调用另一个代码。 当我使用这样的代码时它工作正常: 包括get_template_part('category1','page');
我想使用其他代码,从我的选项面板调用,然后我将代码更改为:
<?php
$post = $wp_query->post;
if (in_category($up_options->cat1)) {
include get_template_part($up_options->category1, 'page');
} elseif (in_category($up_options->cat2)) {
include get_template_part($up_options->category2, 'page');
} else {
include get_template_part('category1', 'page');
}
?>
然后我收到了一个错误:
Warning: include() [function.include]: Filename cannot be empty in D:\0-SERVER\iwpserver\htdocs\wordpress\wp-content\themes\Blogbold\category.php on line 40
Warning: include() [function.include]: Failed opening '' for inclusion (include_path='.;D:\0-SERVER\iwpserver\server\php\PEAR') in D:\0-SERVER\iwpserver\htdocs\wordpress\wp-content\themes\Blogbold\category.php on line 40
第36和40行包含此代码:
Line 36 = include get_template_part($up_options->category1, 'page');
Line 40 = include get_template_part('category1', 'page');
非常感谢任何帮助。 感谢。