个性化阅读
专注于IT技术分析

如何更改hestia上的seciton顺序? [关闭]

点击下载

关闭。这个问题需要调试细节。它当前不接受答案。


想改善这个问题吗?更新问题, 使其成为Stack Overflow的主题。

2年前关闭。

嘿, 香港专业教育学院一直在玩wordpress主题” hestia”, 但我遇到了一个我自己无法解决的问题:

主页由几个部分组成, 你只能在专业版中移动, 我不想购买

我已经浏览了主题代码, 但无法更改顺序, 如果有人能指出正确的方向, 我将不胜感激

在此处输入图片说明

我想将”博客”部分下的”团队”部分移到

感谢塔伦(Tarun)的一个很好的答案, 可悲的是, 当我尝试将代码添加到functions.php时, 出现以下错误:

由于文件wp-content / themes / hestia-child / functions.php的第18行出现错误, 你的PHP代码更改已回滚。请修正并​​尝试再次保存。 Uncaught 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(‘ ‘, 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”文件。 (那里有粘膜切面等)


#1


如果你查看文件./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' );

现在你可以使用子主题了, 我使用了子主题配置器来生成子主题。然后在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');
}
自订主题

之后, 结果如你所愿

博客之后的团队
赞(0)
未经允许不得转载:srcmini » 如何更改hestia上的seciton顺序? [关闭]

评论 抢沙发

评论前必须登录!