嘿,我一直在玩wordpress主题“ hestia”,但是我遇到了一个我自己无法解决的问题:
首页由几个部分组成,您只能在专业版中随意移动,我不想购买
我已经浏览了主题代码,但是无法更改顺序,如果有人能指出正确的方向,我将不胜感激
感谢塔伦(Tarun)的一个很好的答案,可惜当我尝试将代码添加到functions.php时出现以下错误:
由于第18行的错误,您的PHP代码更改已回滚 文件wp-content / themes / hestia-child / functions.php。请修正并尝试 再次保存。
未捕获的ArgumentCountError:函数的参数太少 set_hestia_section_priority(),传入了1个 288行上的wp-includes / class-wp-hook.php,在其中恰好2个 wp-content / themes / hestia-child / functions.php:18堆栈跟踪: 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('',Array)
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('/
此外,我的sections文件夹中似乎没有“ hestia-team-section.php”文件。 (大约有粘膜部分)
答案 0 :(得分:2)
如果您查看文件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');
}
此后结果如您所愿