wordpress - 如何更改赫斯提亚的部分顺序?
问题描述
嘿,伙计们,我一直在玩 wordpress 主题“hestia”,但遇到了一个我自己无法解决的问题:
首页由几个部分组成,您只能使用专业版移动它们,我不想购买
我已经查看了主题的代码,但无法更改顺序,如果有人能指出我正确的方向,我将不胜感激
编辑:
感谢 Tarun 的精彩回答,遗憾的是,在尝试将代码添加到 functions.php 时出现以下错误:
由于文件 wp-content/themes/hestia-child/functions.php 第 18 行的错误,您的 PHP 代码更改已回滚。请修复并再次尝试保存。
未捕获的 ArgumentCountError:函数 set_hestia_section_priority() 的参数太少,第 288 行的 wp-includes/class-wp-hook.php 中传递了 1 个,而 wp-content/themes/hestia-child/functions.php:18 中正好有 2 个。跟踪:0 wp-includes/class-wp-hook.php(288): set_hestia_section_priority(15)
1 wp-includes/plugin.php(203): WP_Hook->apply_filters(15, Array)
2 wp-content/themes/ hestia/inc/sections/hestia-about-section.php(68):
apply_filters('hestia_section_...', 15, 'hestia_about')
3 wp-content/themes/hestia/functions.php(694): include_once( 'w...')
4 wp-includes/class-wp-hook.php(286): hestia_include_features('')
5 wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(' ', 大批)
6 wp-includes/plugin.php(453): WP_Hook->do_action(Array)
7 wp-settings.php(434): do_action('after_setup_the...')
8 wp-config.php(89): require_once( '/
此外,我的部分文件夹中似乎没有“hestia-team-section.php”文件。(hestia-about-section等有没有)
解决方案
如果您查看plugin
文件中的./wp-content/plugins/themeisle-companion/obfx_modules/companion-legacy/inc/hestia/inc/sections/hestia-team-section.php
有下面的代码
if ( function_exists( 'hestia_team' ) ) {
$section_priority = apply_filters( 'hestia_section_priority', 60, 'hestia_team' );
add_action( 'hestia_sections', 'hestia_team', absint( $section_priority ) );
if ( function_exists( 'hestia_team_register_strings' ) ) {
add_action( 'after_setup_theme', 'hestia_team_register_strings', 11 );
}
}
如您所见,有一个apply_filters
$section_priority = apply_filters( 'hestia_section_priority', 60, 'hestia_team' );
现在可以使用子主题了,我Child Theme Configurator
以前是生成子主题的。然后在末尾添加以下代码functions.php
if (!function_exists( 'set_hestia_section_priority') ) {
function set_hestia_section_priority($current, $section_type) {
if ($section_type == 'hestia_team')
return 60;
return $current;
}
add_filter('hestia_section_priority', 'set_hestia_section_priority');
}
之后结果如你所料
推荐阅读
- razor - URL.Page 为 ASP.Core 标识返回 null
- c# - Datarow 未返回确切的行数
- python-3.x - 使用 BeautifulSoup 和 ftlib 访问 ftp 网站时出错
- javascript - 排序数据文本的问题,colspan 单元格失败
- odata - 将 Odata 模型 V2 与 sap.m.list 一起使用
- sql - SQL中不同值之间的第一个更改值
- html - HTML Button 标记中的 IE-11 链接无法正常工作 - 如何修复?
- asp.net-mvc - Bundles/images/user-img-background.jpg 404(未找到)
- python - CRFSuite 有多少训练数据?
- json - 从 API 错误中获取数据,JSON 输入意外结束