开发者

Using sort order to adapt a wordpress plugin

开发者 https://www.devze.com 2023-03-14 00:44 出处:网络
Wonder if anyone can help - I\'m using a plugin called sz subpage list, which is great, But I need to use the \"order\" which you can specify in the wp-admin, and the plugin doesnt appear to support t

Wonder if anyone can help - I'm using a plugin called sz subpage list, which is great, But I need to use the "order" which you can specify in the wp-admin, and the plugin doesnt appear to support this.

I'm trying the following, but it doesnt seem to work - any ideas ?

Basically I replaced the

$pages = get_pages();

for

$pages = get_pages('sort_order=menu_order&sort_order=asc');

here's the original, any ideas ?

Thanks for looking

function getPagesOptionList($selected) {
    $list = '';
    $pages = get_pages();
    foreach($pages as $page开发者_C百科) {
        if ($selected == $page->ID) {
            $list .= '<option selected="selected" value="'.$page->ID.'">'.$page->post_title.' - (id: '.$page->ID.')</option>';
        } else {
            $list .= '<option value="'.$page->ID.'"">'.$page->post_title.' - (id: '.$page->ID.')</option>';
        }
    }
    return $list;
}


I was looking at the wrong line DOH!, further up I found this;

$pages = get_pages('exclude='.$exclude.'&child_of='.$parent);

So I added this in

$pages = get_pages('exclude='.$exclude.'&child_of='.$parent.'&sort_column=menu_order');

All working as should now :)

0

精彩评论

暂无评论...
验证码 换一张
取 消