How do I sort the page list alphabetically?
-
I’ve established that the part of the code that returns the list of pages for the widget to display on is
$page_list = $wpdb->get_results( "SELECT * FROM ".$prefix."posts WHERE post_type='page' && post_status='publish'" ); foreach($page_list as $k => $v) { $for_id = $v->ID . 1; $parent_id = $v->ID; $parent_id = $parentid = get_page($parent_id)->post_parent; $title = substr($v->post_title, 0, 20); $checked = in_array($v->ID, $current_pages) ? "checked" : ""; $ajax_data .= "<span><input {$checked} title='{$parent_id}' type='checkbox' id='{$data["for_id"]}{$for_id}' name='{$data["get_pages_name"]}[]' value='{$v->ID}'><label for='{$data["for_id"]}{$for_id}'>{$title}_{$v->ID}</label></span>"; } $ajax_data .= "</div>"; echo $ajax_data;
I’ve been trying to get the pages to list in post_title alphabetical order instead of post_id numerical order. How do I do it?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How do I sort the page list alphabetically?’ is closed to new replies.