just-a-blog

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | LICENSE

commit 0239bda30fd895fade1fa27a521e0ce5ce93b058
parent c492029df7721f3d42a6b3243b1de5f4cd65f170
Author: Overseer <1836442+robertdherb@users.noreply.github.com>
Date:   Sat, 24 Feb 2018 22:51:53 -0600

Only show markdown files

Diffstat:
functions.php | 2+-
index.php | 3+--
2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/functions.php b/functions.php @@ -63,7 +63,7 @@ function get_posts() { $argc = func_num_args(); $argv = func_get_args(); - $posts = array_diff( scandir( "posts/" ), array( "..", "." ) ); + $posts = preg_grep( '~\.md$~', scandir( "posts/" ) ); $postDates = array(); foreach( $posts as $thisPost ) { $postDates[] = filectime( "posts/" . $thisPost); diff --git a/index.php b/index.php @@ -25,8 +25,7 @@ $title = TITLE; // Change the defined title to a var to let me change it later. define( "BLOG_DIR", BLOGDIR ); -$pages = scandir( "pages/" ); -$pages = array_diff( $pages, array( "..", "." ) ); +$pages = preg_grep( '~\.md$~', scandir( "pages/" ) ); /* Make sure a home page exists. One should be supplied for you. */ if( !file_exists( "pages/home.md" ) ) {