X-Git-Url: https://git.bts.cx/cx.git/blobdiff_plain/e273692a476b38dc06af16deb76cd1d36544b3c0..326cc7d316faee2371e3b7d62e61b5158c681649:/cx/lib/posts.php?ds=sidebyside diff --git a/cx/lib/posts.php b/cx/lib/posts.php index d8f056d..e46aa28 100644 --- a/cx/lib/posts.php +++ b/cx/lib/posts.php @@ -237,7 +237,7 @@ function cx_posts_find_page_id($post_slug) { return null; } -function cx_pages_get() { +function cx_pages_get(bool $include_drafts = false) { $sql = 'SELECT post_id, post_slug, @@ -247,9 +247,15 @@ function cx_pages_get() { post_title, post_data FROM posts - WHERE post_is_page == TRUE - AND post_is_draft == FALSE - ORDER BY post_creation_time ASC;'; + 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);