2014-12-03 35 views
0

我已通过插件注册了一个自定义分类标准wfa_book_genres,此分类标准的slug名称为genres如何通过插件包含档案模板文件

现在我想包括我的自定义分类的插件文件夹中的档案模板。我尝试使用下面的示例代码,但是在进入该归档术语时它显示为完全空白。我不知道如何解决这个问题。我真的被困在这里:

add_filter('template_include', 'wfa_taxonomy_template'); 
function wfa_taxonomy_template($template){ 

/* 
    // if wfa_book_genres taxonomy 
    if(is_tax('wfa_book_genres')){ 
    $template = plugin_dir_url(__FILE__).'taxonomy-wfa_book_genres.php'; 
    } 
    */ 

    // if wfa_book_genres taxonomy slug 
    if(is_tax('genres')){ 
    $template = plugin_dir_url(__FILE__).'taxonomy-wfa_book_genres.php'; 
    } 
    return $template; 
} 

回答

0

变化plugin_dir_url目录名称

$template = dirname(__FILE__).'taxonomy-wfa_book_genres.php'; 
+0

嗨Bhumi,我改变了它,但仍同样的问题。当分类归档页面打开它的显示完全空白。没有条件我也包括这个模板,但没有运气:( – 2014-12-03 13:23:29