post_id,
post_slug,
post_date,
+ post_is_page,
post_is_draft,
post_title,
post_data
post_id,
post_slug,
post_date,
+ post_is_page,
post_is_draft,
post_title,
post_data
return null;
}
-function cx_pages_get() {
+function cx_pages_get(bool $include_drafts = false) {
$sql = 'SELECT
post_id,
post_slug,
post_date,
+ post_is_page,
post_is_draft,
post_title,
post_data
FROM posts
- 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 .= ';';
foreach (cx_db_query($sql) as $post) {
$p = new Post($post);