astra主题search功能异常解决

报错问题

当使用astra侧边栏搜索时,点击搜索后结果空白,发现其他主题正常。
翻看nginx错误日志,发现参数个数匹配错误。

PHP message: PHP Fatal error:  Uncaught ArgumentCountError: 3 arguments are required, 2 given in ...wp-content/themes/astra/inc/core/common-functions.php:
#0 ...wp-content/themes/astra/inc/core/common-functions.php(966): sprintf()
#1 ...wp-content/themes/astra/inc/core/common-functions.php(1043): astra_get_taxonomy_banner_legacy_layout()

此错误仅在中文下有问题,wordpress改成英文也没问题。

解决方法

编辑astra主题文件,在functions.php最下面添加

/**
 * bug-fix in functions.php --add by sidney
 */
add_filter( 'astra_theme_defaults', 'fix_search_title' ); 
function fix_search_title($defaults) {
    $defaults['section-search-page-title-custom-title'] = '<Search title in your language>:';
   return $defaults;
}

发表评论

您的邮箱地址不会被公开。 必填项已用 * 标注

滚动至顶部