- WHERE post_is_page == TRUE
- AND post_is_draft == FALSE
- ORDER BY post_creation_time DESC;';
+ WHERE post_is_page == TRUE';
+
+ if ($include_drafts == false) {
+ $sql .= ' AND post_is_draft == FALSE';
+ }
+
+ $sql .= ' ORDER BY post_date ASC';
+
+ $sql .= ';';