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

如何使用Redux Framework Sorter选项?

点击下载

晚上好, 我设法将redux框架嵌入WP主题, 并且一切正常, 但是我比程序员更像是设计师, 我想使用选项类型” sorter”(https://github.com/根据已启用的列和保存的顺序将ReduxFramework / redux-framework / wiki / Fields#sorter复制到首页中的” get_template_part”。

我的输出用于print_r($ redux_options [‘home_blocks’] [‘enabled’]):

Array
(
    [placebo] => placebo
    [slider] => Slider
    [highlights] => Highlights
    [services] => Services
    [staticpage] => Static Page
)

我想要这样的东西:

slider = get_template_part('templates/content', 'slider');
highlights = get_template_part('templates/content', 'highlights');
services = get_template_part('templates/content', 'services');
staticpage = get_template_part('templates/content', 'staticpage');

当然, 其顺序与数组相同, 如果存在于启用的列中。

我看了shoetrap3, 看看它们如何使分类器看起来很漂亮, 但最新版本(3.1.0.2)中未使用此选项。


#1


尝试这个

global $redux_options;
$layout = $redux_options['home_blocks']['enabled'];

if ($layout): foreach ($layout as $key=>$value) {

    switch($key) {

        case 'slider': get_template_part( 'templates/content', 'slider' );
        break;

        case 'highlights': get_template_part( 'templates/content', 'highlights' );
        break;

        case 'services': get_template_part( 'templates/content', 'services' );
        break;

        case 'staticpage': get_template_part( 'templates/content', 'staticpage' );    
        break;  

    }

}

endif;

#2


在这里领导Redux背后的开发人员。最好在我们的问题跟踪器上解决此类问题:https://github.com/ReduxFramework/ReduxFramework/issues

但是, 你问题的答案在我们的新文档网站中:http://docs.reduxframework.com/redux-framework/fields/sorter/

那将为你提供所需的东西。

如果你想学习更多使用Redux的方法, 明天我们将举办网络研讨会:https://www2.gotomeeting.com/register/797085722

希望能有所帮助。

赞(0)
未经允许不得转载:srcmini » 如何使用Redux Framework Sorter选项?

评论 抢沙发

评论前必须登录!