问题描述
我知道之前曾问过类似的问题,但似乎找不到合适的解决方案。
我为客户开发了一个自定义帖子类型作为模块。尽管CPT存档加载得很好,但类别显示的是空白页(没有通过日志报告错误)。
CPT确实包含
$args = array(
'taxonomies' => array('category'),'has_archive' => true,);
自定义帖子类型为课程。但是,taxonomy-courses.PHP和category-courses.PHP无法正常工作。为了使档案正常工作(不是正常工作),使用以下功能;
function courses_archive_custom($archive_template) {
global $post;
if (is_archive() && get_post_type($post) == 'courses' || is_category() && get_post_type($post) == 'courses') {
$archive_template = plugin_dir_path(__FILE__) . 'archive-courses.PHP';
}
return $archive_template;
}
add_filter('archive_template','courses_archive_custom');
为什么模板不能立即正常工作?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)