如何使用redux框架排序选项


How to use redux framework sorter option?

晚上好,我已经成功地将redux框架嵌入到一个WP主题中,一切都很好,但我更多的是一个设计师而不是一个程序员,我想使用选项类型"排序器"(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');

当然与数组的顺序相同,如果出现在启用的列中。

我已经看了一下shoestrap3,看看他们是如何设法使排序器看起来,但这个选项在最新版本(3.1.0.2)中没有使用

try this

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;

在这里领导Redux的开发。像这样的问题最好在我们的问题跟踪器上提供:https://github.com/ReduxFramework/ReduxFramework/issues

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

你会得到你所需要的。

如果你想学习如何更多地使用Redux,我们明天有一个网络研讨会:https://www2.gotomeeting.com/register/797085722

希望对你有帮助。