首页 文章

Wordpress函数theme_include_lib()

提问于
浏览
0

我有WordPress的问题我收到一个错误:

致命错误:在第51行的/home/peartree/public_html/wp-content/themes/PeartreeArt6/comments.php中调用未定义的函数theme_include_lib()

这是代码的一部分:

// comment form
theme_ob_start();
$args = array();
if (theme_get_option('theme_comment_use_smilies')) {
    function theme_comment_form_field_comment($form_field) {
        theme_include_lib('smiley.php');
        return theme_get_smilies_js() . '<p class="smilies">' .     theme_get_smilies() . '</p>' . $form_field;
    }

    add_filter('comment_form_field_comment',     'theme_comment_form_field_comment');
 }
comment_form();

1 回答

  • 0

    我找到了这个代码out in the wild,这可能有所帮助,也可能没有帮助 . 尝试在/home/peartree/public_html/wp-content/themes/PeartreeArt6/functions.php文件中包含此代码,看看它是否有帮助 . 我首先检查函数是否存在,以防它已在别处定义 .

    if (!function_exists('theme_include_lib')){
      function theme_include_lib($name){
        if (function_exists('locate_template')){
          locate_template(array('library/'.$name), true);
        } else {
          theme_locate_template(array('library/'.$name), true);
        }
      }
    }
    

相关问题