开发者

Using sort order to adapt a wordpress plugin

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜